TodayTools

Address Resolution Protocol

How ARP works

Finds the device behind an IP on your network

Donate
L2Data linkLink
What brings you here?

Watch it happen

How much detail

The laptop knows the router's IP but not its MAC. One broadcast question, one direct answer.

Your laptop
Home switch
Home router
Smart TV
CableLookupRequest

4 steps, 4 packets

First up: Need a MAC. Press Play to watch it happen, one step at a time.

0 of 40/4

What is ARP?

Inside your home or office network, devices actually deliver frames by MAC address, the hardware address of each network card. ARP is the small protocol that turns an IPv4 address into the matching MAC address, by broadcasting a question and waiting for the owner to answer.

Every packet you send to the internet first needs the router's MAC, so ARP runs quietly all the time. It has no security at all: any device can answer, which is how ARP spoofing attacks work.

Think of it like this. ARP is like standing in an office and calling out: who is sitting at desk 1? The person at that desk waves and says: me, I am Omar. Now you can walk over. You remember it for a while, so you do not need to shout next time. But anyone could wave and lie.

Step by step

Normal

4 steps

The laptop knows the router's IP but not its MAC. One broadcast question, one direct answer.

  1. 1

    Need a MAC

    IP is known, MAC is not

    To send anything to the internet, the laptop must put the router's MAC address on the Ethernet frame. Its ARP cache is empty, so it has to ask.

  2. 2

    Broadcast question

    Who has 192.168.1.1?

    The ARP request goes to ff:ff:ff:ff:ff:ff, so the switch copies it to every port. Every device reads it; only the one with that IP answers.

  3. 3

    Direct answer

    192.168.1.1 is at a4:91:b1:00:00:01

    The router replies only to the laptop. It also learns the laptop's MAC from the question, so it will not need to ask back.

  4. 4

    Cached and used

    Frames can now be sent

    The laptop stores the answer in its ARP cache for a few minutes and sends its real traffic. The next packet skips ARP entirely.

Gratuitous ARP

3 steps

A device joining the network checks that its address is free, then announces itself to everyone.

  1. 1

    Probe

    Is 192.168.1.20 free?

    The TV has just been given 192.168.1.20. Before using it, it sends ARP probes with sender IP 0.0.0.0, asking who has that address. If anyone replies, there is a conflict.

  2. 2

    Announce

    192.168.1.20 is at my MAC

    No one answered, so the TV broadcasts an announcement where the sender and target IP are both its own. Nobody asked; that is why it is called gratuitous.

  3. 3

    Caches update

    Everyone learns at once

    Devices that already had 192.168.1.20 in their cache update it. Backup routers use the same trick to take over an address in a second when the main router fails.

ARP spoofing

3 steps

A stranger on the same network sends fake replies and slips between your laptop and the router.

  1. 1

    Fake replies

    Nobody asked, they answer anyway

    ARP trusts any reply, even one nobody asked for. The stranger tells the laptop that 192.168.1.1 is at the stranger's MAC, and tells the router the same about 192.168.1.10.

  2. 2

    Poisoned caches

    Traffic now goes the wrong way

    Both caches now point at the stranger. The laptop's frames for the internet go to the stranger's laptop, which reads them and passes them on, so nothing looks broken.

  3. 3

    Why it matters

    A machine in the middle

    Anything not encrypted can be read or changed. HTTPS, SSH and VPNs still protect their contents, which is one big reason to use them on shared networks. The stranger repeats the lies every few seconds to keep the caches poisoned.

Spoof blocked

3 steps

A managed switch checks every ARP reply against what DHCP handed out and drops the lie.

  1. 1

    Switch keeps a list

    Which MAC got which IP

    A managed switch with DHCP snooping records every address the DHCP server hands out, and on which port.

  2. 2

    Fake reply checked

    192.168.1.1 is not on that port

    Dynamic ARP inspection compares each ARP message with that list. The stranger's reply claims 192.168.1.1 from a port that never got that address.

  3. 3

    Dropped and logged

    The lie never arrives

    The switch drops the frame and logs it. The laptop's cache stays correct. Office and campus networks often turn this on; home switches usually cannot.

Myths and mix-ups

  • ARP does not find devices on the internet; it only works on your own local network.
  • Your laptop does not ARP for a web server's address; it ARPs for the router and lets the router do the rest.
  • ARP replies are not checked; any device can claim any IP, which is why spoofing is easy.
  • IPv6 does not use ARP; it uses neighbour discovery messages over ICMPv6.

Try it yourself

Run these on your own computer to see ARP at work.

  • See your ARP cache

    arp -a

    Works on Windows, macOS and Linux. Each line pairs an IP with a MAC. Your router should be there.

  • See neighbours (Linux)

    ip neigh

    REACHABLE is fresh, STALE needs a recheck before use.

  • See neighbours (Windows PowerShell)

    Get-NetNeighbor -AddressFamily IPv4

    Shows the same cache with its state.

  • Watch ARP live (macOS or Linux)

    sudo tcpdump -n -e arp

    -e shows the MAC addresses. Ping a new device on your network to trigger a request.

ARP at a glance

Layer
Between link (2) and network (3)
Ethernet type
0x0806
Message size
28 bytes for IPv4 over Ethernet
Request sent to
Broadcast ff:ff:ff:ff:ff:ff
Reply sent to
The asker only (unicast)
Scope
One local network, never crosses a router
Defined in
RFC 826 (1982)

Defined inRFC 826RFC 5227

Header fields

What ARP puts in its messages, with example values from the stories above.

ARP

Hardware type
1 (Ethernet)
Protocol type
0x0800 (IPv4)
Hardware size
6
Protocol size
4
Opcode
1 (request)A question: who has this IP address?
Sender MAC
a4:91:b1:00:00:01The answer the laptop was looking for.
Sender IP
192.168.1.10
Target MAC
00:00:00:00:00:00All zeros: this is exactly what the sender does not know yet.
Target IP
192.168.1.1The address the laptop wants a MAC for: its default gateway.

Ethernet II

Destination MAC
ff:ff:ff:ff:ff:ff (broadcast)Broadcast: every device on the network receives this frame.
Source MAC
3c:22:fb:1a:2b:3c
Type
0x0806 (ARP)0x0806 marks an ARP message, not an IP packet.

Test yourself

Question 1 of 4Score 0

Where does an ARP request go?

Questions people ask

What does ARP do?

It finds the MAC address that belongs to an IPv4 address on your local network, so your device can put the right hardware address on the frame.

What is the ARP cache?

A short list your computer keeps of recent IP to MAC answers. Entries expire after a few minutes, then ARP asks again. You can see it with arp -a.

What is ARP spoofing?

An attack where a device on the same network sends fake ARP replies, claiming to be the router or another machine, so traffic flows through it. Encrypted connections and managed switches with ARP inspection defend against it.

Does IPv6 use ARP?

No. IPv6 uses neighbour discovery: Neighbor Solicitation and Neighbor Advertisement messages over ICMPv6, sent to multicast groups instead of a broadcast.

How do I clear the ARP cache?

On Windows run arp -d * as administrator. On Linux run sudo ip neigh flush all. On macOS run sudo arp -a -d.

Donate