Facebook Pixel

The Network Layer

When data travels from one side of the globe to another, it does not move in a straight line. It navigates through countless intermediate routers and completely different networks.

The Network Layer, which is the third layer of the OSI model, handles this complex journey. While the Data Link Layer manages delivery within a single local network, the Network Layer guarantees that data successfully reaches its final destination regardless of how many different networks stand in between.

Network Layer vs Data Link Layer

A common point of confusion is differentiating between Layer 2 and Layer 3. The distinction comes down to the scope of delivery.

For example, the Data Link Layer is like an office assistant delivering a letter from one room to another within the exact same building. The Network Layer is the global postal service that transports a letter from a city in one country to a completely different city across the world, passing through multiple sorting facilities along the way.

  • Data Link Layer: Responsible strictly for Node to Node delivery within the same network using physical MAC addresses.
  • Network Layer: Responsible for End to End or Host to Host delivery across multiple networks using logical IP addresses.

Key Responsibilities

  • Logical Addressing: Assigns unique software based IP addresses to every device. Unlike hardware burned MAC addresses, logical addresses can change based on the network connection.
  • Packetization: Encapsulates data segments received from the Transport Layer into units called packets by adding a header containing source and destination IP addresses.
  • Routing: Determines the absolute best path for a packet to travel. For example, if data is sent from one major city to another, routing algorithms evaluate multiple paths and choose the most efficient one based on hop count and congestion.
  • Forwarding: The physical act of a router receiving a packet on an incoming port, checking its routing table, and instantly moving it to the correct outgoing port.
  • Fragmentation and Reassembly: If a packet exceeds a network's Maximum Transmission Unit limit, it is broken down. For example, a 4000 byte packet will be fragmented into three smaller pieces if the network MTU is only 1500 bytes. These fragments are reassembled at the final destination.
  • Subnetting: Divides massive networks into smaller manageable subnetworks. For example, a company with 500 computers might divide them into 10 isolated subnets of 50 computers to reduce broadcast traffic.

Important Network Layer Protocols

  • Internet Protocol: The fundamental protocol for addressing. It exists in two major versions: IPv4 which uses 32 bit addresses, and IPv6 which uses 128 bit addresses to solve the global address shortage.
  • Internet Control Message Protocol: Used strictly for sending diagnostic information and error messages. For example, the common ping command uses this protocol to test if a destination is reachable.
  • Address Resolution Protocol: Broadcasts a request on a local network to map a known logical IP address to an unknown physical MAC address.
  • Network Address Translation: Translates private internal IP addresses into a single public IP address, allowing an entire private network to access the public internet.

Routing Protocols

Routers cannot magically know the layout of the internet. They use specific routing protocols to automatically discover paths and build their routing tables.

  • Routing Information Protocol (RIP): A basic protocol that chooses the best path based strictly on hop count, with a strict maximum limit of 15 hops. Suitable only for small networks.
  • Open Shortest Path First (OSPF): A complex link state protocol where every router maintains a complete map of the network and uses mathematical algorithms to find the fastest path based on bandwidth cost.
  • Border Gateway Protocol (BGP): The massive backbone routing protocol of the internet. It routes data between completely independent global networks using complex administrative policies.

Routing vs Flooding

FeatureRoutingFlooding
Decision MethodUses a structured routing table.Requires no table at all.
Path SelectionMay not always be the absolute shortest physical path.Guarantees the shortest path will eventually be found.
Traffic GenerationHighly efficient, minimal extra traffic.Generates massive amounts of duplicate traffic.
PracticalityStandard for all modern networks.Highly impractical for general data delivery.

Advantages and Limitations

The Network Layer is incredible because it enables global end to end communication, allows networks to scale massively through subnetting, and completely connects vastly different network technologies.

However, it has limitations. It provides zero flow control, meaning it can easily cause network congestion. It also does not guarantee delivery; if a packet drops, the Network Layer does not recover it, leaving that job to the Transport Layer.

Please Login.
Please Login.
Please Login.
Please Login.
Please Login.