The Network Layer is the third layer of the OSI model responsible for logical addressing, routing, and end-to-end packet delivery across interconnected networks.
- Handles logical (IP) addressing of devices
- Determines optimal routing paths between networks
- Enables host-to-host communication across multiple networks

Note: Unlike the Data Link Layer, which focuses only on node-to-node delivery within a single network segment, the Network Layer ensures that data travels from the source host to the destination host, even if they are located on different networks.
Key Responsibilities
- Uses logical (IP) addresses to identify source and destination hosts.
- Encapsulates transport layer segments into packets for efficient transmission.
- Provides logical delivery of packets from the sender to the intended receiver across interconnected networks on a best-effort basis
- Forwards packets from an incoming interface to the appropriate outgoing interface based on the destination IP address.
- Determines the optimal path for packets to travel across multiple networks using routing algorithms and protocols.
Read more about Functions of Network Layer.
Working
- Each device is assigned a logical address (IP address) for identification and communication within a network.
- Data from the transport layer is encapsulated into packets, with source and destination IPs attached.
- Routers analyze the destination address and determine the best available path.
- Packets traverse the network hop-by-hop, moving across routers until reaching the destination.
- In IPv4, packets may be fragmented when their size exceeds the outgoing link's MTU.
- In IPv6, fragmentation is performed only by the source host.
- At the destination, IPv4 fragments are reassembled into the original packet.
- If errors occur (e.g., unreachable destination), protocols like ICMP send error messages back to the source.

IP Addressing
- Classful Network Addressing
- Classless Network Addressing
- IPv4 Header Format
- IPv4 vs IPv6
- Private vs Public IP addresses
Subnetting
Covers IP address management using subnetting and VLSM to divide large networks into smaller, manageable subnets and calculate address ranges.
- Introduction to Subnetting
- Role of Subnet Mask
- Calculate network, broadcast and host addresses
- Variable Length Subnet Masking (VLSM)
- Supernetting
Routing
This subsection explains how data is routed across networks, covering static vs. dynamic routing and routing algorithms.
Network Layer Protocols and Technologies
Covers key Network Layer protocols such as ARP for device discovery, ICMP for error reporting, DHCP for automatic IP assignment, and dynamic routing protocols like RIP, OSPF, and BGP.
- Internet Protocol(IP): Provides logical addressing and delivers packets between devices across interconnected networks.
- Address Resolution Protocol(ARP): Maps IP addresses to MAC addresses within a local network.
- Reverse Address Resolution Protocol(RARP): Retrieves a device’s IP address using its MAC address (largely obsolete).
- Internet Control Message Protocol(ICMP): Carries error messages and diagnostic information about IP packet delivery.
- Internet Group Management Protocol(IGMP): Manages IPv4 multicast group membership on a network.
- Routing Information Protocol(RIP): Distance-vector protocol using hop count to select routes.
- Open Shortest Path First(OSPF): A link-state protocol that computes the shortest path using network topology.
- Intermediate System to Intermediate System(IS-IS): A link-state routing protocol used to exchange routing information within an autonomous system.
- Enhanced Interior Gateway Routing Protocol(EIGRP): An advanced distance-vector routing protocol that selects efficient routes using multiple metrics.
- Border Gateway Protocol(BGP): A path-vector protocol that routes data between autonomous systems on the Internet.
- Generic Routing Encapsulation(GRE): Encapsulates network-layer packets inside IP packets to create tunnels between networks.
- IPSec (Internet Protocol Security): Secures IP communication through encryption and authentication.
- NAT (Network Address Translation): Converts private IP addresses to public IPs, conserving addresses and improving security.
- Multiprotocol Label Switching(MPLS): Uses labels to forward packets efficiently through a network.
Advantages
- Enables end-to-end communication across multiple networks.
- Supports scalability by allowing subnetting and hierarchical addressing.
- Efficiently routes packets using routing algorithms and dynamic routing protocols.
- Provides inter-networking by connecting heterogeneous networks.
Disadvantages
- Does not provide end-to-end flow control, so congestion can occur when network resources are overloaded.
- Provides limited error handling and does not guarantee reliable delivery; reliability is generally handled by upper-layer protocols such as TCP.
- Routers may drop packets under heavy load, leading to possible data loss.
- Fragmentation increases processing overhead and may affect performance.
Routing vs Flooding
| Routing | Flooding |
|---|---|
| Uses a routing table to determine the path. | Does not require a routing table. |
| May select the shortest or best path depending on the routing algorithm. | Does not specifically select the shortest path. |
| Generally provides controlled and efficient delivery. | Can improve delivery reliability by using multiple paths. |
| Generates less network traffic. | Generates more network traffic. |
| Generally avoids duplicate packets. | May generate duplicate packets. |