What it means
IP addresses say where a packet is going. On a local Ethernet or Wi-Fi network, the frame that carries it needs a hardware address, called a MAC address. ARP connects the two. A device broadcasts a question to everyone on the local network: who has this IP address? The owner replies with its MAC address, and the asker keeps the answer in a cache for a while.
ARP only ever finds the next hop. For a destination on the same network, that is the destination itself. For anything further away, it is the gateway. ARP has no authentication. A device accepts whatever answer arrives, so a machine on the same network can claim the gateway address and receive traffic meant for it. That is ARP spoofing.
See the idea / Networks
ARP finds the next hop's MAC address, not the far server's.
Watch a laptop send to a remote address. It asks the local network for its gateway's hardware address and addresses the frame to that.
Nyx's test bench, one Ethernet network, 192.0.2.0/24. The laptop is 192.0.2.23 with a valid lease and an empty ARP cache, the table where it keeps answers. Its gateway is 192.0.2.1. It wants to send an IP packet to 203.0.113.80. A MAC address is the hardware address of a network port. The next hop is the device that receives the frame first.
01 / 04
Next hop
203.0.113.80 is outside the laptop's own network, 192.0.2.0/24. So the next hop is the gateway, 192.0.2.1. The laptop has no MAC address for it yet.
More about this step
The subnet mask tells the laptop which addresses are local. 192.0.2.42 would be local, and the laptop would ask for that address itself. 203.0.113.80 is not local, so the first frame must go to the default gateway. The laptop never uses ARP to find a machine across the internet.
Step through at your own pace.
Keep in mindARP works only on the local network. Nothing in an ARP reply is authenticated, so any device there can send a false one. That is ARP spoofing. The reply does not show that the gateway can reach 203.0.113.80. IPv6 uses Neighbor Discovery for this job. Cache expiry and the forwarding table in the switch are not shown.
Read the visual, step by step
- Next hop. 203.0.113.80 is outside the laptop's own network, 192.0.2.0/24. So the next hop is the gateway, 192.0.2.1. The laptop has no MAC address for it yet. The subnet mask tells the laptop which addresses are local. 192.0.2.42 would be local, and the laptop would ask for that address itself. 203.0.113.80 is not local, so the first frame must go to the default gateway. The laptop never uses ARP to find a machine across the internet.
- Request. The laptop broadcasts an ARP request: who has 192.0.2.1? The switch copies it to every other port on the local network. The request is an Ethernet frame to the broadcast address ff:ff:ff:ff:ff:ff with EtherType 0x0806. It has no IP header around it. It carries the laptop pair, 192.0.2.23 at 02:00:00:00:00:10, so the owner of 192.0.2.1 knows where to answer.
- Reply. The gateway answers the laptop directly: 192.0.2.1 is at 02:00:00:00:00:01. The laptop stores that pair in its ARP cache. The reply is sent to the laptop MAC address only, not broadcast. Other devices saw the request and stayed silent because the address was not theirs. The laptop accepts the answer without any proof of who sent it. That is why a false reply can redirect traffic.
- Frame. The laptop puts the packet in a frame addressed to the gateway's MAC. The IP destination inside is still 203.0.113.80. Ethernet carries the packet one hop, to 02:00:00:00:00:01. The IP header still names the remote host. The gateway will build a new frame for its own next hop. With the pair cached, later packets to remote addresses go out without another ARP request until the entry expires.
ARP works only on the local network. Nothing in an ARP reply is authenticated, so any device there can send a false one. That is ARP spoofing. The reply does not show that the gateway can reach 203.0.113.80. IPv6 uses Neighbor Discovery for this job. Cache expiry and the forwarding table in the switch are not shown.
Flow references: RFC 826: An Ethernet Address Resolution Protocol · RFC 5227: ARP probes and why ARP replies are not authenticated · RFC 4861: Neighbor Discovery for IPv6
AN ILLUSTRATIVE SCENARIO
A hotel guest network
A hotel's guests complain of certificate warnings on the lobby Wi-Fi. A technician compares the ARP cache on two laptops and sees the gateway IP address mapped to a MAC address that is not the router's. Another guest's laptop has been answering ARP requests for the gateway and passing traffic through itself. The hotel turns on client isolation and the switch feature that checks ARP replies against its record of issued addresses.
Put it to work
- Learn to read the ARP cache on your own system, and know the real MAC address of your gateway.
- On managed switches, turn on DHCP snooping and Dynamic ARP Inspection so false replies are dropped.
- Use encrypted protocols such as TLS everywhere, so redirected traffic cannot be read or silently changed.
How to check your work
Read the ARP cache on two hosts. Confirm that both map the gateway IP address to the same MAC address, and that it matches the label or configuration of the real gateway.
Connect the ideas
- IP address
A numeric locator used to deliver packets to a host on a network.
- DHCP
The protocol that hands a device its IP address and network settings for a limited time, called a lease, when it joins a network.
- VLAN
A way to split one physical switch network into separate logical networks. Devices in different VLANs cannot reach each other without passing a router or firewall.
- NAC
Controls that check a device, and often its health, before the network lets it join, usually at the switch port or wireless access point.