Network Layer
Network Layer
• The network Layer is the third layer in the OSI model of computer
networks. Its main function is to transfer network packets from the
source to the destination. It is involved both the source host and the
destination host.
• At the source, it accepts a packet from the transport layer,
encapsulates it in a datagram, and then delivers the packet to the
data link layer so that it can further be sent to the receiver.
• At the destination, the datagram is decapsulated, and the packet is
extracted and delivered to the corresponding transport layer.
Task at Network layer
✔ It handles the service requests from the transport layer and further
forwards the service request to the data link layer.
✔ The network layer translates the logical addresses into physical
addresses
✔ It determines the route from the source to the destination and also
manages the traffic problems such as switching, routing and controls
the congestion of data packets.
✔ The main role of the network layer is to move the packets from
sending host to the receiving host.
Layer -3
• In the 7-layer OSI model (see below), the network layer is layer 3.
The Internet Protocol (IP) is one of the main protocols used at this layer,
along with several other protocols for routing, testing, and encryption.
• Suppose Bob and Alice are connected to the same local area network
(LAN), and Bob wants to send Alice a message.
• Because Bob is on the same network as Alice, he could send it directly to
her computer across the network.
• However, if Alice is instead on a different LAN several miles away, Bob's
message will have to be addressed and sent to Alice's network before it can
reach her computer, which is a network layer process.
Features of Network Layer
• The process of encapsulating the data received from the upper layers of the network (also called
payload) in a network layer packet at the source and decapsulating the payload from the network
layer packet at the destination is known as packetizing.
The source host adds a header that contains the source and destination address and some other
relevant information required by the network layer protocol to the payload received from the
upper layer protocol and delivers the packet to the data link layer.
The destination host receives the network layer packet from its data link layer, decapsulates the
packet, and delivers the payload to the corresponding upper layer protocol.
• The routers in the path are not allowed to change either the source or the destination address.
• The routers in the path are not allowed to decapsulate the packets they receive unless they need to
be fragmented.
•
The network layer is the third layer in
the OSI model and is responsible for
breaking down the data segments into
data packets and is tasked with
reassembling them on the receiver side.
Layer handles
• The network layer handles these data packets by integrating them
with source and destination addresses.
• It also integrates the network protocols for proper transmission over
the network channel to the data-link layer.
Network Addressing
The network layer does the task of adding the source and destination address in the header in the network channel.
Network addressing is performed to identify the device where the data is being shared on the channel.
Inter-Networking
• It is one of the main tasks of the network layer to handle the network
connection between multiple devices in the channel.
Establishing a routing path for the data packet is one of the main functions of the network layer in a network model.
The Network layer is responsible for choosing the most suitable routing path out of all available network channels.
Forwarding table
• In Network layer, a router is used to forward the packets. Every router has a forwarding
table.
• A router forwards a packet by examining a packet's header field and then using the
header field value to index into the forwarding table.
• The value stored in the forwarding table corresponding to the header field value indicates
the router's outgoing interface link to which the packet is to be forwarded.
• For example, the router with a header field value of 0111 arrives at a router, and then
router indexes this header value into the forwarding table that determines the output link
interface is 2.
• The router forwards the packet to the interface 2. The routing algorithm determines the
values that are inserted in the forwarding table.
• The routing algorithm can be centralized or decentralized.
2. Routing
• Routing is the process of moving data from one device to another device.
• These are two other services offered by the network layer. In a network,
there are a number of routes available from the source to the destination.
• The network layer specifies some strategies which find out the best
possible route.
• This process is referred to as routing.
• There are a number of routing protocols that are used in this process and
they should be run to help the routers coordinate with each other and help
in establishing communication throughout the network.
Packet Network - Router
Multiple path to reach Destination
Routing Forwarding
Forwarding is simply defined as the action
Routing is the process of moving data from one
applied by each router when a packet arrives at
device to another device.
one of its interfaces.
Works on protocols like Routing Information Works on protocols like UDP Encapsulating
Protocol (RIP) for Routing. Security Payloads
Other Services Expected from Network Layer
❑ Error Control
❑ Flow Control
❑ Congestion Control
1. Error Control
• TCP protocol has methods for finding out corrupted segments, missing segments,
out-of-order segments and duplicated segments.
• Error control in TCP is mainly done through the use of three simple techniques :
• Checksum – Every segment contains a checksum field which is used to find corrupted
segments. If the segment is corrupted, then that segment is discarded by the destination
TCP and is considered lost.
• Acknowledgement – TCP has another mechanism called acknowledgement to affirm that
the data segments have been delivered. Control segments that contain no data but have
sequence numbers will be acknowledged as well but ACK segments are not
acknowledged.
• Retransmission – When a segment is missing, delayed to deliver to a receiver, corrupted
when it is checked by the receiver then that segment is retransmitted again. Segments are
retransmitted only during two events: when the sender receives three duplicate
acknowledgements (ACK) or when a retransmission timer expires.
• Retransmission after RTO: TCP always preserves one retransmission
time-out (RTO) timer for all sent but not acknowledged segments.
When the timer runs out of time, the earliest segment is
retransmitted. Here no timer is set for acknowledgement. In TCP, the
RTO value is dynamic in nature and it is updated using the round trip
time (RTT) of segments. RTT is the time duration needed for a
segment to reach the receiver and an acknowledgement to be
received by the sender.
• Retransmission after Three duplicate ACK segments: RTO method
works well when the value of RTO is small. If it is large, more time is
needed to get confirmation about whether a segment has been
delivered or not. Sometimes one segment is lost and the receiver
receives so many out-of-order segments that they cannot be saved.
In order to solve this situation, three duplicate acknowledgement
method is used and missing segment is retransmitted immediately
instead of retransmitting already delivered segment. This is a fast
retransmission because it makes it possible to quickly retransmit lost
segments instead of waiting for timer to end.
Congestion Control in Computer Networks
• What is congestion?
• A state occurring in network layer when the message traffic is so
heavy that it slows down network response time.
•
• Effects of Congestion
• As delay increases, performance decreases.
• If delay increases, retransmission occurs, making situation worse.
•
Congestion control algorithms
• The leaky bucket algorithm discovers its use in the context of network
traffic shaping or rate-limiting.
• A leaky bucket execution and a token bucket execution are
predominantly used for traffic shaping algorithms.
• This algorithm is used to control the rate at which traffic is sent to the
network and shape the burst traffic to a steady traffic stream.
• The disadvantages compared with the leaky-bucket algorithm are the
inefficient use of available network resources.
• The large area of network resources such as bandwidth is not being
used effectively.
Let us consider an example to understand
• The leaky bucket algorithm has a rigid output design at an average rate
independent of the bursty traffic.
• In some applications, when large bursts arrive, the output is allowed to speed up.
This calls for a more flexible algorithm, preferably one that never loses
information. Therefore, a token bucket algorithm finds its uses in network traffic
shaping or rate-limiting.
• It is a control algorithm that indicates when traffic should be sent. This order
comes based on the display of tokens in the bucket.
• The bucket contains tokens. Each of the tokens defines a packet of predetermined
size. Tokens in the bucket are deleted for the ability to share a packet.
• When tokens are shown, a flow to transmit traffic appears in the display of
tokens.
• No token means no flow sends its packets. Hence, a flow transfers traffic up to its
peak burst rate in good tokens in the bucket.
Need of token bucket Algorithm:-
• The leaky bucket algorithm enforces output pattern at the average rate, no
matter how bursty the traffic is. So in order to deal with the bursty traffic
we need a flexible algorithm so that the data is not lost. One such
algorithm is token bucket algorithm.
•
• Steps of this algorithm can be described as follows:
•
• In regular intervals tokens are thrown into the bucket. ƒ
• The bucket has a maximum capacity. ƒ
• If there is a ready packet, a token is removed from the bucket, and the
packet is sent.
• If there is no token in the bucket, the packet cannot be sent.
• Let’s understand with an example,
•
• In figure (A) we see a bucket holding three tokens, with five packets
waiting to be transmitted. For a packet to be transmitted, it must
capture and destroy one token. In figure (B) We see that three of the
five packets have gotten through, but the other two are stuck waiting
for more tokens to be generated.
• Ways in which token bucket is superior to leaky bucket: The leaky
bucket algorithm controls the rate at which the packets are
introduced in the network, but it is very conservative in nature. Some
flexibility is introduced in the token bucket algorithm. In the token
bucket, algorithm tokens are generated at each tick (up to a certain
limit). For an incoming packet to be transmitted, it must capture a
token and the transmission takes place at the same rate. Hence some
of the busty packets are transmitted at the same rate if tokens are
available and thus introduces some amount of flexibility in the
system.
• Formula: M * s = C + ? * s where S – is time taken M – Maximum
output rate ? – Token arrival rate C – Capacity of the token bucket in
byte
Difference between Flow Control and Congestion
Control
• Flow control is a technique used to regulate the flow of data between different
nodes in a network. It ensures that a sender does not overwhelm a receiver with
too much data too quickly. The goal of flow control is to prevent buffer overflow,
which can lead to dropped packets and poor network performance.
• Advantages of Flow Control:
• Prevents buffer overflow: Flow control prevents buffer overflow by regulating the
rate at which data is sent from the sender to the receiver.
• Helps in handling different data rates: Flow control helps in handling different
data rates by regulating the flow of data to match the capacity of the receiving
device.
• Efficient use of network resources: Flow control helps in efficient use of network
resources by avoiding packet loss and reducing the need for retransmissions.
Disadvantages of Flow Control:
• May cause delays: Flow control may cause delays in data transmission
as it regulates the rate of data flow.
• May not be effective in congested networks: Flow control may not be
effective in congested networks where the congestion is caused by
multiple sources.
• May require additional hardware or software: Flow control may
require additional hardware or software to implement the flow
control mechanism.
Congestion Control:
Flow control is typically used in data link layer. Congestion control is applied in network and transport layer.
In this, Receiver’s data is prevented from being overwhelmed. In this, Network is prevented from congestion.
In flow control, sender needs to take measures to avoid In this, many algorithms designed for transport layer/network
receiver from being overwhelmed depending on feedback layer define how endpoints should behave to avoid
from receiver and also in absence of any feedback. congestion.
Description Detail
Impact of attack:
Products affected by CVE