Labs ICT
โญ Pro Login

The Network Layer

How data finds its way across multiple networks.

Crossing Network Boundaries

The Network Layer is where networking gets truly interesting. While the Data Link Layer handles delivery within a single local network, the Network Layer handles delivery across multiple networks โ€” all the way from your device to a server on the other side of the world.

This is the layer that makes the internet possible. It's responsible for logical addressing (IP addresses) and routing (finding the best path through a maze of interconnected networks).

What Does the Network Layer Do?

  • Logical Addressing โ€” Assigns IP addresses to devices. Unlike MAC addresses (which are flat and permanent), IP addresses are hierarchical and change depending on which network you're connected to.
  • Routing โ€” Determines the best path for data to travel from source to destination. Routers use routing tables to make forwarding decisions.
  • Packet Forwarding โ€” Moves packets from one router to the next along the chosen path.
  • Fragmentation and Reassembly โ€” If a packet is too large for a link's MTU (Maximum Transmission Unit), it's broken into smaller fragments and reassembled at the destination.

Packets

At the Network Layer, data is called a packet. A packet consists of a header (containing source and destination IP addresses, TTL, protocol type, etc.) and a payload (the actual data being transmitted).


  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
  โ”‚              IP Packet                   โ”‚
  โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
  โ”‚  Header  โ”‚           Payload             โ”‚
  โ”‚(20-60 B) โ”‚      (up to 65,535 B)        โ”‚
  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Key Protocols at This Layer

The Network Layer hosts several critical protocols:

  • IPv4 โ€” The most widely used protocol. Provides 32-bit addresses (about 4.3 billion unique addresses).
  • IPv6 โ€” The successor to IPv4. Provides 128-bit addresses (340 undecillion addresses โ€” enough for every atom on Earth).
  • ICMP โ€” Internet Control Message Protocol. Used for error reporting and diagnostics (ping, traceroute).
  • ARP โ€” Address Resolution Protocol. Maps IP addresses to MAC addresses on the local network.
  • IGMP โ€” Internet Group Management Protocol. Manages multicast group memberships.

The Journey of a Packet

When you send data to a server across the internet, here's what happens at the Network Layer:


  Your PC โ”€โ”€โ†’ Router A โ”€โ”€โ†’ Router B โ”€โ”€โ†’ Router C โ”€โ”€โ†’ Server
  192.168.1.5   10.0.0.1   72.14.200.1  8.8.8.8    172.217.14.99

  Each router:
  1. Receives the packet
  2. Reads the destination IP
  3. Looks up the best route in its routing table
  4. Forwards the packet to the next hop
  5. Repeats until it reaches the destination

The source and destination IP addresses don't change (usually). What changes is the MAC address at each hop โ€” the Data Link Layer rewrites the MAC address for each local link, while the Network Layer maintains the end-to-end IP addresses.

๐Ÿงช Quick Quiz

Which OSI layer is responsible for routing?