Network Layer
The network layer is the 5th Layer from the sender and the 3rd layer from the receiving side in the OSI model.
At the Sender Side, the Network layer receives segments from the transport layer, converts these segments into packets/datagrams, and transmits these packets/datagrams to the data link layer.
At the Receiver Side, the Network layer receives frames from the data link layer, converts these frames to packets/datagrams, and then transmits them to the transport layer.
Functionality of Network Layer
The network layer has various functions. Let’s explain all functions one by one,
1. Source to Destination Delivery
The network layer provides Source to destination Delivery, which is also called HOST-to-HOST delivery. The following figure shows host-to-host delivery
2. Routing
The networking layer uses the Router device to determine the best optimal path out of the multiple paths from the source to the destination. The router uses routing protocols (i.e., RIP, OSPF, etc.)
3. Addressing
As we know, the Network layer is used when source-to-destination delivery is required in different networks or over the Internet. The network layer uses the Logical (IP) Address to communicate over the internet. IP address contains the network ID and Host ID of the destination machine. The network layer uses IPV4 or IPV6 for addressing purposes.
4. Fragmentation
Sometimes, when a sender sends a packet to a router, the router may not have enough space to accommodate the entire packet. So, it is necessary to break these packets into fragments (parts).
So, the fragmentation of packets/datagrams is also the responsibility of the network layer.
5. Congestion Control
In the case when maximum nodes send the data at a time to the same router even with fragmentations, then the buffer of the router may be out of capacity. In this case, traffic must be controlled. Controlling traffic is called congestion control. So, in some cases, congestion control is required, which is also the responsibility of the Network layer.
6. Flooding
When a data packet arrives at a router, the router sends this data to all the outgoing links from the router except the link from which the data arrived.
Explain with example
Suppose there are 5 routers (A, B, C, D, and E) which are connected through transmission lines as given below.
By using the flooding technique
- An incoming data packet from the sender will be sent to Router A.
- Router A will forward the data packet to other routers B, C, and D.
- B will send the packet to C.
- C will send the packet to B, D, and E.
- D will send the packet to C and E.
- E will send the packet to D.
Note: The main advantage of flooding is that the shortest path is always chosen by flooding because, in flooding, each router holds the information of its neighbors.
In the upcoming lectures, we will see the details of network Layer functionalities.
1. Logical Addressing
-
Assigns a unique IP address to each device on a network.
-
Identifies both host and network portions of an address.
-
Used for communication between devices across different networks.
-
Example:
192.168.1.1
(IPv4),2001:0db8::1
(IPv6)
2. Routing
-
Finds the best path for data to travel across networks.
-
Performed by routers using dynamic routing protocols like:
-
OSPF (Open Shortest Path First)
-
BGP (Border Gateway Protocol)
-
RIP (Routing Information Protocol)
-
-
Adapts to network changes such as link failures or congestion.
3. Packet Forwarding
-
Forwards incoming packets to the appropriate next hop.
-
Uses a routing table to decide where to send each packet.
-
Happens on every router between source and destination.
4. Fragmentation and Reassembly
-
Breaks large packets into smaller pieces to match the MTU.
-
Each fragment includes headers to help rebuild the original packet at the destination.
-
Necessary when sending data across networks with different MTU sizes.
5. Error Handling and Diagnostics
-
Uses ICMP (Internet Control Message Protocol) for:
-
Error messages (e.g., destination unreachable)
-
Network diagnostics (e.g., ping, traceroute)
-
-
Helps in troubleshooting network issues.
6. Congestion Control (Basic)
-
Detects and helps avoid network congestion.
-
May drop packets or inform the source to reduce transmission rate.
-
Note: True congestion control is more prominent in the Transport Layer.
7. Quality of Service (QoS) Support
-
Ensures priority handling of sensitive data (like voice or video).
-
Assigns different priorities to different types of packets.
-
Helps maintain performance under load.
8. Internetworking
-
Allows communication between heterogeneous networks.
-
Ensures devices on different types of physical networks can interoperate.
-
Core concept behind the Internet itself.
9. Casting (Unicast, Broadcast, Multicast, Anycast)
Determines how packets are sent:
-
Unicast: One to one
-
Broadcast: One to all
-
Multicast: One to many (group)
-
Anycast: One to nearest (used in IPv6)