Concepts / Ethernet and ARP

Ethernet and ARP

MAC address

Also called hardware address, Ethernet 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.

  1. Every Ethernet card has a 48-bit hardware address, its MAC address: alice's is 1e:fa:0f:8d:39:1e.
  2. To send to bob, alice puts bob's MAC, 66:72:05:84:ed:66, at the front of the frame.
  3. The network delivers the frame by that address, and bob's card takes it in; a card ignores frames for other MACs.
  4. One MAC is special: ff:ff:ff:ff:ff:ff, the broadcast address, is taken in by every card on the network.
Six bytes: the maker's half, then the card's own
Six bytes: the maker's half, then the card's own

A MAC address is 48 bits, written as six hex bytes. The first three bytes name the maker of the card, the last three are the number the maker gave this card. ff:ff:ff:ff:ff:ff is the broadcast address, which every card on the network accepts.

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.

See it on real machines

Read next

Learn it on real machines.

Every lab is a small network of real Linux machines in your browser. Sign in with Google or email to start.

Start this lab