5.1 IP Addressing, Classes, and Subnetting
The Network Layer (Layer 3) enables host-to-host packet delivery across multiple interconnected networks. An IPv4 Address is a 32-bit logical address represented in dotted-decimal format (e.g. 192.168.1.1).
Figure 5.1: Structure of Class A, B, and C IPv4 addresses showing the shifting boundary between Network and Host bits.
5.2 The IPv4 Packet Header Structure
Every IPv4 packet carries a 20 to 60-byte header containing control metadata required by intermediate routers to verify, fragment, and route the payload to its destination.
Figure 5.2: Field-by-field layout of the standard IPv4 packet header.
5.3 Routing Algorithms: Distance Vector vs Link State
Routing algorithms determine the optimal mathematical path for forwarding packets from origin to destination across interconnected networks of routers.
Figure 5.3: Distance Vector routers share full tables with immediate neighbours; Link State routers flood link states to reconstruct the global map.
5.4 Routing Protocols (RIP, OSPF, BGP) and NAT
Real-world networks use standardized protocols to dynamically populate router forwarding tables:
- RIP (Routing Information Protocol): Distance-vector protocol using hop count metric (max 15 hops; 16 signifies infinity/unreachable). Sends updates every 30 seconds via UDP port 520.
- OSPF (Open Shortest Path First): Interior Gateway Protocol (IGP) based on Link-State technology. Divides networks into hierarchical areas (Area 0 = Backbone Area) and calculates shortest paths using Dijkstra's algorithm.
- BGP (Border Gateway Protocol): Path-Vector Exterior Gateway Protocol (EGP) that connects distinct Autonomous Systems (AS) and routes all global Internet inter-domain traffic.
- Network Address Translation (NAT): Enables thousands of private RFC 1918 hosts (e.g.
192.168.x.x,10.x.x.x) to share a single public routable IP address using Network Address Port Translation (NAPT/PAT).