ARP cache

term

networking

Kept in this browser · My desk

A host's table of IP-to-MAC address mappings learned through the Address Resolution Protocol (ARP), consulted before every frame is sent to a neighbour on the local network.

RFC 826 calls it the translation table and leaves ageing to the implementer; Linux keeps it as the neighbour table, whose entries move through the states reachable, stale, delay, probe and failed, with permanent and noarp for entries the kernel does not validate. Its weakness is the merge rule: an existing entry takes the hardware address of any ARP packet whose sender claims that IP address, which is what ARP poisoning exploits.

What it is. The ARP cache is a host's table of IP-to-MAC (media access control) address mappings learned through the Address Resolution Protocol (ARP); the host consults it before every frame it sends to a neighbour on the local network, and only asks the network when the entry is missing or doubtful. RFC (Request for Comments) 826 (November 1982) calls it the translation table and stores triplets of protocol type, sender protocol address and sender hardware address; Linux keeps it as the IPv4 half of its neighbour table, beside the IPv6 neighbour cache.

How long an entry lives. RFC 826 left ageing outside the protocol: it may be desirable to have table ageing and timeouts, Plummer wrote, and suggested either resetting an entry's timer whenever a packet arrives from that host or having a daemon send a unicast REQUEST to the cached address and delete the entry if no REPLY comes. Linux follows the second idea, the same Neighbor Unreachability Detection written down for IPv6 in RFC 4861 (September 2007), whose constants match Linux's ARP defaults: an entry is reachable for a random time between half and one and a half times base_reachable_time, 30 seconds, so between 15 and 45 seconds; positive feedback from a higher layer, such as a TCP acknowledgement, extends it; then it goes stale. Sending to a stale entry moves it to delay for delay_first_probe_time (5 seconds), then to probe, with up to ucast_solicit (3) unicast probes; if those fail the kernel broadcasts mcast_solicit (3) requests and the entry fails. The garbage collector keeps at least gc_thresh1 (128) entries, may exceed gc_thresh2 (512) for 5 seconds and never holds more than gc_thresh3 (1,024); locktime (1 second) stops thrashing when two hosts claim one address; unres_qlen limits to 3 the packets queued while an address is unresolved.

States you will see. Linux keeps it as the neighbour table, whose entries move through the states reachable, stale, delay, probe and failed, with permanent and noarp for entries the kernel does not validate; ip neigh show prints them, and incomplete marks a request still waiting for a reply. A worked timeline: at second 0 a host resolves its gateway 192.0.2.1 (an RFC 5737 documentation address) and the entry is reachable; TCP traffic keeps confirming it; the gateway reboots with a new network card, the confirmations stop, and some 15 to 45 seconds later the entry is stale; the next packet moves it to delay, 5 seconds later to probe, three unicast probes to the old address go unanswered, a broadcast request finds the new card, and the entry is reachable again with the new address. Routers behave differently: their ARP entries commonly last hours (4 hours is the Arista EOS default Ivan Pepelnjak cites, and the GTER 45 slides give the same for Cisco and Juniper), which is long enough to outlive a switch's 5-minute MAC table and flood traffic.

Reading it. A complete entry for the default gateway is the first thing to check when a host cannot leave its subnet, and an entry for the gateway that carries an unfamiliar hardware address is the first sign of poisoning. An incomplete or failed entry means no reply came back: wrong VLAN (virtual local area network), a cable, a filter, or a host that is down.

Its weakness. The cache's weakness is the merge rule: an existing entry takes the hardware address of any ARP packet whose sender claims that IP address, which is what ARP poisoning exploits. The National Vulnerability Database (NVD) record CVE-1999-0667 says it in one line for the protocol as a whole, and implementations have made it worse: CVE-2000-0612 records that Windows 95 and Windows 98 let spoofed ARP packets overwrite even static entries, and Cisco's 2002 tests found static entries overwritten by gratuitous ARP on Windows NT 4 and Windows 2000. Tools that write to other hosts' caches are ordinary: iputils arping sends unsolicited ARP with -U or -A precisely to update neighbours' caches, and its manual warns against installing it set-uid root for that reason.

Protecting it. A static or permanent entry stops the host believing neighbours about one address, as H D Moore's hardcoded router entry did for the metasploit.com server in 2008; the Linux arp_accept setting only decides whether gratuitous ARP may create new entries, because an existing one is updated regardless. Permanent entries are never garbage-collected, which is their strength and their cost: when the gateway's card changes, every static entry must change too. The rest of the protection lives outside the host: dynamic ARP inspection on the switch, arpwatch on the segment, encryption for what crosses it. Neighbours: ARP, ARP poisoning, gratuitous ARP, address conflict detection, the MAC address, and in IPv6 the neighbour cache of Neighbor Discovery.

Also known as: arp cache, arp table, neighbour cache, neighbor cache, tabela arp, cache arp

Sources

← Back to A Back to the glossary