On link or off link
When a host wants to send a packet, it first asks a simple question. Is the destination on my own subnet or not? It answers this by applying its subnet mask to both its own address and the destination.
Two paths
- If the destination is on link, the host resolves the destination MAC with ARP and sends the frame directly.
- If the destination is off link, the host cannot reach it alone. It hands the packet to its default gateway, the router on its subnet.
The gateway is just an IP address the host is configured with, usually by DHCP. The host sends the packet to the gateway MAC but keeps the final destination IP intact, so the router can forward it onward.
Why it matters
Without a default gateway a host can only talk to neighbors on its own subnet. The gateway is the single doorway to everything else, which is why a wrong gateway setting breaks all outside access while local pings still work.
Key idea
The default gateway is the router a host uses for any destination that is not on its own subnet.