Compared
MAC address vs IP address
A MAC address names a network card and delivers frames inside one network. An IP address names a device across networks, and routers forward by it. On the way the IP addresses stay the same end to end, while a router rewrites both MAC addresses at every hop. ARP links the two.
Side by side
| MAC address | IP address | |
|---|---|---|
| Size | 48 bits | 32 bits (IPv4) or 128 bits (IPv6) |
| Written as | Six hex bytes: 02:42:0a:00:01:0a | 10.0.1.10, or fd00:0:1::2 |
| Layer | Link (2): frames | Network (3): packets |
| Reaches | Its own network only | Any network, through routers |
| Belongs to | A network card | A card on one network, with a prefix length |
| Across a router | Both are rewritten at every hop | Unchanged end to end, unless NAT rewrites them |
| See it with | ip link, ip neigh | ip addr |
Each one explained
- MAC address
- The 48-bit address of a network card, used to deliver frames within one network.
- IP address
- A device's address across networks: 32 bits, written as four numbers like 10.0.1.10.
- ARP
- How a device finds the MAC address behind an IP address on its own network.
- Ethernet frame
- The envelope a packet travels in across one link: destination MAC, source MAC, type, payload.
See the difference on real machines
Each lab is a small network of real Linux machines in your browser.
- MAC and ARP: how an IP address finds a card
- IP addresses: what the four numbers mean
- Learning switches: how a box with no list finds every machine
Open MAC and ARP: how an IP address finds a card