Sub topic 2
The Default Route
Assume you know basic IP subnets, Ethernet frames, and MAC addresses. A router connects different IP networks. A switch connects devices within a local network. An end host sends packets to a configured gateway when the destination is outside its local subnet.
The default route
A default route matches any destination that has no more specific match. In IPv4, it is 0.0.0.0/0. In IPv6, it is ::/0. The router usually sends matching packets to an upstream router called the default gateway.
A route such as 10.1.0.0/16 takes priority over the default route because it has a longer prefix. The default route is therefore a last resort, not a route that overrides all others.
Next hops and directly connected networks
A routing entry identifies an outgoing interface and often a next-hop IP address. If the destination network is directly connected, the router sends the packet directly through that interface. Otherwise, it sends the packet to the next router listed by the route.
For a default route such as 0.0.0.0/0 via 192.0.2.1, the router forwards unknown IPv4 destinations to 192.0.2.1.
Rewriting the Layer 2 frame: ARP and neighbor discovery
The IP packet keeps its original source and destination addresses across routers. The Ethernet frame changes at every hop:
- The source MAC becomes the router’s outgoing-interface MAC.
- The destination MAC becomes the next hop’s MAC.
- The router uses ARP for IPv4 or Neighbor Discovery (ND) for IPv6 to resolve that MAC address.
The router then transmits a new frame on the selected link.
Step by step: what happens to one packet
- The router receives and validates a Layer 2 frame.
- It removes the frame header and examines the IP destination.
- It decrements TTL or Hop Limit.
- It selects the best route, including the default route if needed.
- It resolves the next hop’s Layer 2 address.
- It creates a new frame and sends the packet through the chosen interface.
The IP destination does not change during ordinary forwarding. The Layer 2 addresses do.
TTL, Hop Limit, and ICMP error messages
IPv4 TTL and IPv6 Hop Limit prevent packets from circulating forever. Each router decreases the value by one. If it reaches zero, the router discards the packet and usually sends an ICMP Time Exceeded message to the source. traceroute uses these messages to reveal hops.
ip route get 8.8.8.8
traceroute 8.8.8.8Exercise
A router has routes for 10.0.0.0/8 and 0.0.0.0/0. Which route handles 10.4.2.1?
Show answer
The 10.0.0.0/8 route, because it is more specific than the default route.