Baud
All protocols

ARP

How a host turns an IP address into the MAC address it needs.

The request

28 bytes asking: who has 192.168.1.1?

ARP request · 28 bytes04812162024000000000001000000010800001000000000000006000001100400000100000000000001000000013C001111002200100010FB11111011AA1010101001000000012000100000C011000000A81010100001000000011400010100000000000000000000000000000000000000000000000000000000000000C011000000A81010100001000000010100000001Hardware typeProtocol typeHardware lengthProtocol lengthOperationSender MACSender IPTarget MACTarget IPClick a field to inspect it

Whole frame

Twenty-eight bytes that mean: 'I am 192.168.1.20 at 3C:22:FB:AA:01:20. Whoever owns 192.168.1.1, tell me your MAC.'

FieldOffsetExample valueMeaning
Hardware typeByte 0–10x0001 = EthernetThe link layer in use. 1 = Ethernet. ARP was designed to be generic, so it says which kind of hardware address follows.
Protocol typeByte 2–30x0800 = IPv4The network-layer address being resolved, using EtherType numbers. 0x0800 = IPv4.
Hardware lengthByte 46Length of a hardware address in bytes: 6 for a MAC.
Protocol lengthByte 54Length of a protocol address in bytes: 4 for IPv4.
OperationByte 6–71 = request1 = request ('who has this IP?'), 2 = reply ('I do, here is my MAC').
Sender MACByte 8–133C:22:FB:AA:01:20The asker's MAC. The target will cache it so it can answer without asking back.
Sender IPByte 14–17192.168.1.20The asker's IP.
Target MACByte 18–2300:00:00:00:00:00 (?)Unknown, which is the whole point: all zeros in a request.
Target IPByte 24–27192.168.1.1The IP being asked about: the router.

Overview

Ethernet frames are addressed by MAC, but applications use IP addresses. Before the first packet to a neighbour can leave, the host asks the whole LAN 'who has this IP?' using ARP (Address Resolution Protocol) and remembers the answer.

ARP is small and trusting: any host can answer, and nothing is authenticated. That makes ARP spoofing a classic LAN attack and is one reason IPv6 replaced it with Neighbor Discovery.

Key facts

Layer
Between link and network
Size
28 bytes (IPv4 over Ethernet)
EtherType
0x0806
Request goes to
FF:FF:FF:FF:FF:FF
Standard
RFC 826

The reply

The same layout with the roles swapped.

ARP reply · 28 bytes048121620240000000000010000000108000010000000000000060000011004000001000000000000020000001000000000001A000110102B001010113C001111004D010011015E01011110C011000000A810101000010000000101000000013C001111002200100010FB11111011AA1010101001000000012000100000C011000000A81010100001000000011400010100Hardware typeProtocol typeHardware lengthProtocol lengthOperationSender MACSender IPTarget MACTarget IPClick a field to inspect it

Whole frame

The same 28 bytes with the sender and target swapped and the blanks filled in. The asker stores 192.168.1.1 → 00:1A:2B:3C:4D:5E in its ARP cache.

FieldOffsetExample valueMeaning
Hardware typeByte 0–1EthernetSame as the request.
Protocol typeByte 2–3IPv4Same as the request.
Hardware lengthByte 46Same as the request.
Protocol lengthByte 54Same as the request.
OperationByte 6–72 = reply2 = reply. Unlike the request, the reply is unicast straight back to the asker.
Sender MACByte 8–1300:1A:2B:3C:4D:5EThe answer: the router's MAC. This is what the asker wanted.
Sender IPByte 14–17192.168.1.1The IP that was asked about.
Target MACByte 18–233C:22:FB:AA:01:20Now filled in with the original asker's MAC.
Target IPByte 24–27192.168.1.20The original asker's IP.

The exchange

Question, answer, then the packet that needed the answer.

Laptop192.168.1.20Router192.168.1.1ARP requestto FF:FF:FF:FF:FF:FFARP replyunicastIP packetdst MAC 00:1A:...cache: empty192.168.1.1 = 00:1A:2B:3C:4D:5E

Whole exchange

ARP is the glue between IP addresses and MAC addresses on one LAN: broadcast a question, unicast an answer, cache the result.

  1. 1Who has 192.168.1.1?

    The laptop wants to send a packet to its router but only knows the IP. It broadcasts an ARP request to every host on the LAN.

  2. 2192.168.1.1 is at 00:1A:...

    Only the owner of 192.168.1.1 answers, and directly to the asker. The laptop caches the mapping (usually for minutes) so it does not have to ask again.

  3. 3Now the real packet

    With the MAC known, the Ethernet frame carrying the actual IP packet can be addressed to the router.

Where you meet it

  • Every IPv4 LAN: it runs before nearly every first packet to a neighbour
  • Gratuitous ARP announces a new or moved address and detects IP conflicts
  • `arp -a` shows the cache on your own machine

Watch out for

  • ARP only works within one broadcast domain. For hosts beyond the router you ARP for the router's MAC, not the far host's.
  • Stale cache entries after swapping hardware cause 'works for a while, then fails' puzzles; flushing the cache fixes it.
  • Replies are accepted unauthenticated, so ARP spoofing can redirect traffic on an untrusted LAN.

Standards

  • RFC 826: An Ethernet Address Resolution Protocol

Related protocols