Ethernet and ARP
MAC address
The 48-bit address of a network card, used to deliver frames within one network.
The problem
Many cards share one network, so every frame needs an address that says which card it is for.
- Every Ethernet card has a 48-bit hardware address, its MAC address: alice's is
1e:fa:0f:8d:39:1e. - To send to bob, alice puts bob's MAC,
66:72:05:84:ed:66, at the front of the frame. - The network delivers the frame by that address, and bob's card takes it in; a card ignores frames for other MACs.
- One MAC is special:
ff:ff:ff:ff:ff:ff, the broadcast address, is taken in by every card on the network.
What you'd see
$ ip link show eth0
14: eth0@if15: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
link/ether 1e:fa:0f:8d:39:1e brd ff:ff:ff:ff:ff:ff link-netnsid 0
- After
link/ether: alice's MAC address, six bytes in hex. - After
brd: the broadcast MAC, all ones. - The first byte,
1e, has its second-lowest bit set: software made this address up (locally administered), as for every container. A card's factory address has the bit clear.
Guess first
Alice pings the file server, 10.0.2.10, behind the router. Whose MAC is on the frame that leaves her card?
Show answer
The router's, 8e:75:f9:1e:4d:e3. A MAC address only counts on its own network: the router builds a new frame for the next one, while the IP addresses stay the same end to end.
In short
A MAC address is the 48-bit number of a network card, written as six hex bytes: 02:42:0a:00:01:0a. Frames on
Ethernet and Wi-Fi are delivered by MAC address; the IP address is only looked at once the frame arrives. A MAC
address never leaves its own network: a router writes new MAC addresses at every hop, while the IP addresses stay the
same end to end.
Read next
- 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.
- Switch Joins devices into one network, forwarding each frame toward the port its destination MAC was seen on.
- IP address A device's address across networks: 32 bits, written as four numbers like 10.0.1.10.
- OSI model Seven layers that split networking into jobs, from signals on a cable to the program, each wrapping the one above.
- Network interface A card a machine sends and receives through, switched on or off, with or without a live link.
- MAC filtering Letting in only listed MAC addresses at an access point or switch port: easy to set up, and easy to get past.
- 802.1X and EAP Port login: a switch port (or Wi-Fi association) passes only login frames until the device proves who is using it.
- ARP spoofing Forged ARP messages that tie someone else's IP address, usually the gateway's, to the attacker's MAC address.