← All chapters
Chapter 5· 5 min read · illustrated

The Default Gateway

The device your packets go to when the destination is not on your network

Last chapter, the subnet mask told us when a destination is outside our network. This short chapter answers the obvious follow-up: so where do we send it then? The answer is the default gateway.

01

Where we are in the story

We have built up a chain: IP structure → network vs host → subnet mask. Each one builds on the last, so the order matters. Now we add the default gateway.

Tap to enlarge
02

Same network is easy

If the subnet-mask check says the target is on our network, we simply send directly to it (using its MAC address — a mechanism we cover soon). No problem there.

Tap to enlarge
03

The out-of-network problem

The interesting case: we know the target’s IP (say DNS resolved a domain to it), but the subnet mask told us it is not on our network. We have an address, but no direct path. How do we send it?

Tap to enlarge
04

The default gateway is the router

The answer is the default gateway — which in a home network is your router. When a device does not know how to reach an IP directly, it forwards the packet to its default gateway and effectively says: "I do not know where this is, but I assume you do — please forward it."

Tap to enlarge
05

The door to the outside world

The router then routes the packet onward — possibly through many more routers — until it reaches the destination network. Your default gateway is the single door through which everything leaving your network passes.

Definition: The default gateway is the device that knows how to reach the outside network. To get anywhere beyond your own network, you go through it.

Tap to enlarge
06

How your device knows its gateway

You do not configure this yourself — the default gateway is set automatically when your device connects to the router (again via DHCP). It is typically the router’s own IP, like 192.168.1.1.

Coming up: To actually hand the packet to the gateway, we need its MAC address — which pulls in MAC addresses and ARP, the next chapters.

Tap to enlarge