Addresses
Every device on a network has two addresses. Its hardware address stays the same wherever the device goes. Its IP address changes when the device joins another network. A packet carries both, and each one does a different job on the way.
Two addresses on every device
A device joins a network through its The part of a device that joins it to a network: the socket a cable plugs into, or the radio that talks to Wi-Fi. A laptop often has one of each.. When the card is made, its maker writes a The address a network card is given when it is made. Devices on the same local network use it to deliver messages to each other. into it, such as 3c:22:fb:0a:91:7e. It is six pairs of characters, made of the digits 0 to 9 and the letters a to f. The first half says who made the card. The second half is a number the maker gives each card, so no two cards should have the same address. Settings screens usually call it the MAC address, short for media access control address.
An The address of a device on a network. Packets from any network find the device by it. looks different: four numbers with dots between them, such as 192.168.1.23. IP is short for The rules every device on the internet follows to send packets to each other. IP for short.. A device is not born with an IP address. The network it joins gives it one, usually without anyone noticing. Counting like a computer and Reading an IP address show how to read the four numbers.
| Where | Hardware address | IP address |
|---|---|---|
| Home | 3c:22:fb:0a:91:7e | 192.168.1.23 |
Visit each place, then come back home. Watch which address changes.
Your own addresses
Your phone or laptop shows both addresses in its Wi-Fi settings. Many phones and some laptops give each Wi-Fi network a made-up hardware address instead of the card's own. This makes them harder to track from place to place. The made-up address works the same way, only inside the local network.
A name on a door, and a postal address
Think of an apartment building. A postal address gets a letter to the right building from anywhere in the world. Inside the building, the name on a door finds the right apartment. When you move, your postal address changes, but your name goes with you.
| In the building | On a network |
|---|---|
| Postal address of the apartment | IP address: reaches the device from anywhere |
| Name on the door | Hardware address: finds the device on its local network |
| Moving to a new home | Joining another network: new IP address, same hardware address |
The comparison fails in two places. Two people can share a name, but each card's hardware address is meant to be different from every other. And a letter keeps one envelope the whole way, but a packet gets a new outer envelope at every stop.
Why a device needs both
A device can send a packet straight to another device only if both are on the same local network. A local network is the devices joined in one place, such as everything on your home Wi-Fi and cables. There, the hardware address is enough. It says exactly which device a packet is for.
But the hardware address says nothing about where a device is. So it cannot help find a device on another network. The IP address does that job. It says which network a device is on, and which device it is on that network. So every router on the way can tell where to pass the packet next. A router, as you saw in the first lesson, joins one network to another.
So a packet carries both, like an envelope inside an envelope:
- The inner envelope has the IP addresses: from the device that sent the packet, to the device it is for.
- The outer envelope has the hardware addresses: from the device sending it now, to the next stop on the local network.
Each step of the way, across one link from one device to the next, is called a One step on a packet's way, across one link: from a device to a router, or from one router to the next..
Outer envelope: hardware addresses, for this hop only
- From
- 3c:22:fb:0a:91:7e Laptop
- To
- 00:1a:2b:3c:4d:01 Floor router, laptop side
Inner envelope: IP addresses, for the whole way
- From
- 10.1.0.20 Laptop
- To
- 10.3.0.50 Server
Letter: “Please send me today’s report.”
The laptop put its letter in an inner envelope with both IP addresses. It put that in an outer envelope for the first stop, the floor router.
Every router does the same four things:
- The packet arrives in an outer envelope addressed to the router's hardware address.
- The router throws the outer envelope away. It reads the IP address on the inner envelope to see where the packet is going.
- It picks the next stop on the way there: another router, or the device itself.
- It puts the inner envelope into a new outer envelope, from its own hardware address to the next stop's.
Routers and the gateway shows how a router picks the next stop.
One exception
Your home router usually changes the "from" IP address of each packet that leaves for the internet. The lesson on NAT explains why. Other routers leave the IP addresses as they are.