S1 / 08 MODULE 8 / NETWORK LAYER
Address the destination.
Choose the next hop.
The network layer provides logical addressing and moves packets between networks. Hosts and routers use routing information to decide where a packet should go next.
Network-layer responsibilities
The network layer provides logical addressing and routing between networks. It identifies the source and destination IP addresses, selects a path toward the destination, and forwards packets across interconnected networks. IP is connectionless and best-effort: it does not guarantee delivery, ordering, or recovery from loss. Those services, when needed, are provided by higher-layer protocols.
IMG-0641 · IMG-0764Understand the IP packet
IPv4 and IPv6 packets carry source and destination IP addresses and control information used for forwarding. Routers inspect the destination address and relevant header fields, then choose an outgoing interface or next hop. IPv4 uses a Time to Live (TTL) field to prevent packets circulating indefinitely. IPv6 uses a Hop Limit field for the same purpose. Each router decrements the value before forwarding.
IPv4 packet · IPv6 packetHow a host decides where to send a packet
A host compares the destination IP address with its own subnet. If the destination is local, the host sends directly to that device after resolving its link-layer address. If the destination is remote, the host sends the packet to its configured default gateway. The IP destination remains the final remote host; the first-hop frame is addressed to the gateway's MAC address.
IMG-0636 · IMG-0643 · IMG-0195Read a router routing table
A router's routing table contains destination prefixes and instructions for reaching them. Directly connected routes are learned from active interfaces. Static routes are configured by an administrator. Dynamic routing protocols exchange route information with other routers. When multiple installed routes match a destination, the router uses longest-prefix match to choose the most specific prefix. Route selection has distinct stages: administrative distance compares route sources for the same prefix, a routing protocol metric compares paths within that protocol, and longest-prefix match chooses the most specific installed route for the destination. If no more-specific route matches, a configured default route may be used.
IMG-0602 · IMG-0639Interpret IPv4 and IPv6 headers
IPv4 includes Version, Differentiated Services, Total Length, Identification, Flags, Fragment Offset, TTL, Protocol, Header Checksum, and source/destination addresses. Protocol identifies the next-level protocol, such as TCP (6), UDP (17), or ICMP (1); it is not a TCP or UDP port. IPv6 has a fixed 40-byte base header with Version, Traffic Class, Flow Label, Payload Length, Next Header, Hop Limit, and 128-bit source/destination addresses. Payload Length counts bytes after the base header. Next Header identifies an extension header or an upper-layer protocol.
IPv4 header · IPv6 base header · packet fieldsRelate packet size to the outgoing MTU
The maximum transmission unit (MTU) is the largest network-layer packet a link can carry in one frame. If an IPv4 packet exceeds the outgoing MTU and the Do not Fragment (DF) flag is clear, a router may fragment it. Each fragment has its own IPv4 header, shares the original Identification value, and uses a Fragment Offset measured in 8-byte units. If DF is set, the router drops the packet and normally reports the MTU constraint with an ICMP fragmentation-needed message. IPv6 routers do not fragment packets in transit; the source host handles fragmentation when needed, using an IPv6 Fragment extension header after Path MTU Discovery feedback such as ICMPv6 Packet Too Big.
IPv4 MTU · DF/MF flags · Fragment Offset · IPv6 fragmentationWalk a packet to a remote host
Example: PC-A is 192.168.10.25/24, its default gateway is 192.168.10.1, and the destination server is 203.0.113.80.
- PC-A applies its /24 mask and sees that 203.0.113.80 is outside 192.168.10.0/24.
- PC-A keeps 203.0.113.80 as the packet's destination IP, but sends the Ethernet frame to the default gateway's MAC address.
- The router removes the incoming Layer 2 header, checks the destination IP against its routing table, and selects the best matching route.
- The router builds a new Layer 2 frame for the next link. The frame addresses change at each routed hop; the source and destination IP addresses normally remain the same end to end.
- At the destination LAN, the final router resolves the server's link-layer address and delivers the frame.
Key distinction: the default gateway is the next hop for the host, not the packet's final IP destination.
CHECK YOUR UNDERSTANDING
Follow a packet to a remote network.
Practice host routing, default gateways, IP addressing, and longest-prefix match.