Default Gateway, finding other IP networks

A computer that has an IP address and a Subnet Mask can talk directly with other computers that share the same Subnet Mask and have IP addresses within the same IP network.

pcs-on-same-network-communicate

But what about a computer that wants to talk with something that has an IP address on another IP network? In the below example the left computer belongs to IP network 192.168.1.0 and the right computer belongs to IP network 192.168.2.0 – two different IP networks.

PC's on different IP networks

In previous parts, we concluded that to be able to communicate with other IP networks a router must be used. The computers above need to communicate via a router. But how does the traffic actually end up in a router?

To find its local router the computer needs a so-called Default Gateway, sometimes simply called a Gateway. A Default Gateway is always a router that can connect to more than one IP network and can route traffic between those IP networks. The router will have its own IP address on each IP network that it connects to.

A computer can only talk with other IP addresses within its own IP network. So for the computer to be able to communicate via a router, at least one of the router’s IP addresses must belong to the same IP network as the computer.

When the router hands out an IP address and a Subnet Mask to the computer it also sends out its own IP address to the computer and tells the computer to use that address as its Default Gateway.

Router acting as Default Gateway

With the help of the Default Gateway address, the computers can then find their way to all other IP networks in the whole world. The computer knows that it can talk directly with any other IP address on the same IP network as itself. But as soon as it needs to talk to any other IP network it just needs to send the traffic to the Default Gateway, which is the router. Then the router will take over responsibility for routing the traffic towards the destination on the Internet.

So you could say that by sending the traffic to the default gateway the computer is delegating responsibility for forwarding the traffic to the router. The computer will trust that the router can find the destination. In turn, the home router will then trust the ISP’s routers to take over responsibility for forwarding traffic further along the path toward the destination.

Previous part:
IP addresses

Next part:
DNS, linking names with IP addresses