The Internet
A router is a device that connects networks together. Data travelling across the internet is split into packets, and a router takes each packet that arrives and forwards it on towards its destination.
Every packet carries a header, and inside that header is the destination IP address. When a packet reaches a router, the router reads that address to work out which network the packet is heading for. It does not make the decision using a MAC address: a MAC address identifies a piece of hardware on a local network, so it cannot tell a router where a device on a distant network is. Routing decisions are based on IP addresses.
The router checks the destination IP address against its routing table. This is a list of the networks the router knows about, paired with the next router or link that leads towards each one. For example, a packet addressed to 203.0.113.42 arrives at a router holding this table:
| Destination network | Send to |
|---|---|
| 203.0.113.0 | Router A |
| 198.51.100.0 | Router B |
| 192.0.2.0 | Router C |
| any other address | Router D |
The destination address belongs to the network 203.0.113.0, so the router sends the packet to Router A.
A router does not need to know the whole path. It only chooses the next router on the way, and that router then makes its own decision from its own table. The packet hops from router to router until it reaches the network containing the destination device. You can think of a relay race: each runner only needs to know who to hand the baton to next, not every step of the course.
Edexcel GCSE Computer Science · The Internet