How Networks Work Module 2: Your local network Lesson 2.1 12 min

Ethernet frames and MAC addresses

Every message on your home network travels inside an Ethernet frame, addressed by MAC address. Take a frame apart byte by byte, and send one to everyone at once.

Your laptop, your phone, your printer and your smart TV all share one home network. When your laptop sends something to the printer, how does the printer know it is for it, and how does the TV know to ignore it?

Every message on a local network travels in an Ethernet frame, and every frame starts with two addresses: who it is for, and who sent it. Those addresses are not IP addresses. They are burnt into each network card.

A MAC address

Each network card (Ethernet or Wi-Fi) has a MAC address: 6 bytes, usually written as six pairs of hexadecimal digits, like 02:00:00:00:00:0a. (Hexadecimal counts 0 to 9 then a to f, so one pair is a number from 0 to 255.) The first half traditionally says which company made the card; the second half is the card’s own number.

A MAC address only means something on the local network: the devices you can reach without passing through a router. It names the card, not where the card is. That is why, as you will see in Module 3, a MAC address never travels beyond the first router.

Inside a frame

Here laptop-a, on a switch with three other laptops, pings laptop-b. The very first frame it sends is a question for everyone (you will learn what it asks in Lesson 2.3). The Bytes view shows that frame.

Inside an Ethernet frame

  1. laptop-a: ping -c 1 192.168.1.11 Look at the first 6 bytes: ff ff ff ff ff ff. That is the destination. The next 6 bytes are laptop-a's own MAC address, the source. Then 08 06: the EtherType, which says an ARP message is inside.
    Time
    0 µs
    Cable
    laptop-a eth0 → sw1 1
    Ethernet
    02:00:00:00:00:0a → ff:ff:ff:ff:ff:ff (broadcast)
    ARP
    who has 192.168.1.11? tell 192.168.1.10
    On the wire
    64 bytes
    laptop-a ARP cache
    192.168.1.11: asking (INCOMPLETE)
  2. sw1 sends a broadcast out of every other port sw1 writes down where 02:00:00:00:00:0a is: port 1. The frame is for ff:ff:ff:ff:ff:ff, everyone on the network, so sw1 sends a copy out of every port except the one it came in on (2, 3, 4).
    Time
    100.512 µs
    Cable
    sw1 2 → laptop-b eth0 (+2 more)
    Ethernet
    02:00:00:00:00:0a → ff:ff:ff:ff:ff:ff (broadcast)
    ARP
    who has 192.168.1.11? tell 192.168.1.10
    On the wire
    64 bytes
    sw1 MAC table
    learned 02:00:00:00:00:0a → port 1
  3. laptop-b: ARP: 192.168.1.11 is at 02:00:00:00:00:0b laptop-b answers only the one who asked: 192.168.1.11 is at 02:00:00:00:00:0b. laptop-b saves it in its ARP cache: 192.168.1.10 is at 02:00:00:00:00:0a.
    Time
    201.024 µs
    Cable
    laptop-b eth0 → sw1 2
    Ethernet
    02:00:00:00:00:0b → 02:00:00:00:00:0a
    ARP
    192.168.1.11 is at 02:00:00:00:00:0b
    On the wire
    64 bytes
    laptop-b ARP cache
    192.168.1.10 is at 02:00:00:00:00:0a
  4. sw1 forwards it out of port 1 only sw1 writes down where 02:00:00:00:00:0b is: port 2. sw1 knows 02:00:00:00:00:0a is on port 1, so only that port gets the frame.
    Time
    301.536 µs
    Cable
    sw1 1 → laptop-a eth0
    Ethernet
    02:00:00:00:00:0b → 02:00:00:00:00:0a
    ARP
    192.168.1.11 is at 02:00:00:00:00:0b
    On the wire
    64 bytes
    sw1 MAC table
    learned 02:00:00:00:00:0b → port 2
  5. laptop-a: ICMP echo request seq=1 192.168.1.10 → 192.168.1.11 This frame is addressed to one card only: its destination is laptop-b's MAC address, 02:00:00:00:00:0b, and the EtherType 08 00 says an IP packet is inside.
    Time
    402.048 µs
    Cable
    laptop-a eth0 → sw1 1
    Ethernet
    02:00:00:00:00:0a → 02:00:00:00:00:0b
    IP
    192.168.1.10 → 192.168.1.11
    TTL
    64
    ICMP
    echo request, seq 1
    On the wire
    102 bytes
    laptop-a ARP cache
    192.168.1.11 is at 02:00:00:00:00:0b
  6. sw1 forwards it out of port 2 only sw1 knows 02:00:00:00:00:0b is on port 2, so only that port gets the frame.
    Time
    502.864 µs
    Cable
    sw1 2 → laptop-b eth0
    Ethernet
    02:00:00:00:00:0a → 02:00:00:00:00:0b
    IP
    192.168.1.10 → 192.168.1.11
    TTL
    64
    ICMP
    echo request, seq 1
    On the wire
    102 bytes
  7. laptop-b: ICMP echo reply seq=1 192.168.1.11 → 192.168.1.10 laptop-b answers with an echo reply.
    Time
    603.68 µs
    Cable
    laptop-b eth0 → sw1 2
    Ethernet
    02:00:00:00:00:0b → 02:00:00:00:00:0a
    IP
    192.168.1.11 → 192.168.1.10
    TTL
    64
    ICMP
    echo reply, seq 1
    On the wire
    102 bytes
  8. sw1 forwards it out of port 1 only sw1 knows 02:00:00:00:00:0a is on port 1, so only that port gets the frame.
    Time
    704.496 µs
    Cable
    sw1 1 → laptop-a eth0
    Ethernet
    02:00:00:00:00:0b → 02:00:00:00:00:0a
    IP
    192.168.1.11 → 192.168.1.10
    TTL
    64
    ICMP
    echo reply, seq 1
    On the wire
    102 bytes
  9. laptop-a receives ICMP echo reply seq=1 192.168.1.11 → 192.168.1.10 laptop-a gets the frame. The reply arrived 0.805 ms after the request left: that is the round-trip time. laptop-a prints: rtt min/avg/max/mdev = 0.805/0.805/0.805/0.000 ms
    Time
    805.312 µs
    Ethernet
    02:00:00:00:00:0b → 02:00:00:00:00:0a
    IP
    192.168.1.11 → 192.168.1.10
    TTL
    64
    ICMP
    echo reply, seq 1
    On the wire
    102 bytes

An Ethernet frame has four parts:

Part Size What it says
Destination MAC 6 bytes Which card should take this frame
Source MAC 6 bytes Which card sent it
EtherType 2 bytes What is inside: 0800 IPv4, 0806 ARP, 86dd IPv6
Payload 46 to 1,500 bytes The message, padded with zeros if it is short
Frame check sequence (FCS) 4 bytes A checksum, so the receiver can spot damaged bits and drop the frame

When a frame arrives, a network card compares the destination MAC with its own. If they match, it passes the frame up to the computer. If not, it ignores the frame.

Broadcast: a frame for everyone

The destination ff:ff:ff:ff:ff:ff is special. It is the broadcast address, and it means “every card on this network”. Every device takes a broadcast frame and reads it. Switch to the Map view in the lab above and step through: laptop-c and laptop-d both received the first frame (the broadcast), but neither of them received the ping that followed, which was addressed to laptop-b alone.

Broadcasts are how a device asks a question when it does not yet know who to ask. They are also expensive: every device has to stop and read them, so networks keep them rare.

In the real world

Phones, laptops and tablets now usually invent a random MAC address for each Wi-Fi network they join, instead of using the one burnt into the card. A fixed MAC address would let shops, airports and anyone running Wi-Fi recognise the same device wherever it goes. Android, iOS, Windows and macOS all do this by default for Wi-Fi. A random address has the “locally administered” bit set, which is why it often starts with a digit like 2, 6, a or e in its second place, just like the addresses in these labs.

Recap

  • Every local message travels in an Ethernet frame: destination MAC, source MAC, EtherType, payload, FCS.
  • A MAC address is 6 bytes and names a network card on the local network only.
  • A card takes frames addressed to its own MAC and ignores the rest.
  • ff:ff:ff:ff:ff:ff is broadcast: every device on the network takes it.
  • The smallest frame is 64 bytes on the wire; short payloads are padded.

Quick check

  1. What does a MAC address identify?
  2. A frame's destination is ff:ff:ff:ff:ff:ff. Who takes it?
  3. Does your laptop's MAC address reach a website's server on the other side of the world?

Your progress is saved in this browser. Sign in to keep it on every device. Free, no password.

Join the discussion