Leaving the LAN: the default gateway
Your laptop can only talk directly to devices on its own LAN. Follow one packet to a server on another network: the mask check, the ARP question for the gateway's MAC address, and two routers that each throw away the old frame, lower TTL and build a new one. MAC addresses change at every hop; IP addresses do not.
5 quick questions
Pick an answer to see why. Your score saves with your progress.
01Your laptop is 192.0.2.10 with mask 255.255.255.0. Which destination can it reach without the gateway?
192.0.2.77 AND 255.255.255.0 = 192.0.2.0, the laptop's own network. The others give a different network, so they go to the gateway.
02The laptop sends its first frame toward the far server. What is the frame's destination MAC address?
A frame only travels one link. Its destination MAC is the next stop, the gateway; the destination IP inside still names the server.
03Why does the laptop send an ARP request before the first frame?
The laptop knows the gateway's IP (192.0.2.1) from its settings, but an Ethernet frame needs a MAC address. ARP turns the IP into the MAC.
04What stays the same in every frame from the laptop to the server (with no NAT)?
IP addresses name the two ends and stay the same end to end. MAC addresses are rewritten on every link, and TTL goes down by one at each router.
05A packet leaves the laptop with TTL 64 and passes through two routers. What TTL does the server see?
Each router lowers TTL by one before forwarding: 64, then 63 after router 1, then 62 after router 2.
Glossary
- Default gateway
- The router a device sends packets to when the destination is not on its own LAN. Here 192.0.2.1.
- Subnet mask
- A number like 255.255.255.0 that marks which part of an IP address is the network. AND it with an address to get the network.
- MAC address
- The hardware address of a network card, like 00:00:5e:00:53:0a. Ethernet frames are addressed by MAC, one link at a time.
- Ethernet frame
- The envelope a packet travels in across one link. It carries a destination MAC, a source MAC and a type.
- ARP
- Address Resolution Protocol: asks the LAN “who has this IP?” and the owner replies with its MAC address.
- Routing table
- A router's list of networks and where to send packets for each, matched by the longest prefix.
- TTL
- Time To Live: a hop counter in the IP header. Each router lowers it by one; at zero the packet is dropped.
- Hop
- One link a packet crosses, from one device to the next.
Notes and sources
- All addresses are documentation values: IPv4 from RFC 5737 and MAC addresses from RFC 7042 (00:00:5e:00:53:xx). ff:ff:ff:ff:ff:ff is the real Ethernet broadcast address.
- Here every LAN uses public addresses, so nothing rewrites the IPs. A home LAN with 192.168.x.x addresses also needs NAT at its router, which swaps the source address; that is a later lesson.
- The routers already know their neighbours’ MAC addresses from earlier ARP exchanges, so the figure shows ARP only once.
- If TTL ever reaches 0, a router drops the packet and sends back an ICMP Time Exceeded message. That is what stops packets looping forever, and how traceroute works.
- RFC 791: Internet Protocol (IPv4)
- RFC 1122: Requirements for Internet Hosts (§3.3.1, routing outbound datagrams)
- RFC 1812: Requirements for IP Version 4 Routers
- RFC 826: An Ethernet Address Resolution Protocol (ARP)
- RFC 5737: IPv4 Address Blocks Reserved for Documentation
- RFC 7042: IANA Considerations for IEEE 802 Parameters (documentation MACs)
- IEEE 802.3: Ethernet
Quiz Unlocks after the last step.