https://stackoverflow.com/questions/15372011/configuring-arp-age-timeout
Files related to ARP cache
/proc/sys/net/ipv4/neigh/default/gc_interval /proc/sys/net/ipv4/neigh/default/gc_stale_time /proc/sys/net/ipv4/route/gc_interval /proc/sys/net/ipv4/route/gc_timeout
gc_timeout seconds gc_stale_time seconds
There are subtle differences between an neighbor cache entry actually falling out of the cache entirely or just being marked as stale/invalid. At some point between base_reachable_time/2 and 3*base_reachable_time/2, the entry will still be in the cache, but it will be marked with a state of STALE. You should be able to view the state with “ip -s neighbor show”,
pherricoxide@midigaurd:~$ ip -s neighbor list 192.168.42.1 dev eth0 lladdr 00:25:90:7d:7e:cd ref 2 used 184/184/139 probes 4 STALE 192.168.10.2 dev eth0 lladdr 00:1c:23:cf:0b:6a ref 3 used 33/28/0 probes 1 REACHABLE 192.168.10.1 dev eth0 lladdr 00:17:c5:d8:90:a4 ref 219 used 275/4/121 probes 1 REACHABLE
To mark entries as invalid, but not remove them from the cache
$ ip -s -s neigh flush all
To delete a particular entry
$ arp -d <ip_address>
$ ip link set arp off dev eth0; ip link set arp on dev eth0
The simplest way to completely clean the arp cache is to bring the interface down and then up again.
Else you can also change the cache timeout
$ echo 30 > /proc/sys/net/ipv4/neigh/default/gc_stale_time $ echo 175 > /proc/sys/net/ipv4/route/gc_timeout $ echo 20000 > /proc/sys/net/ipv4/neigh/default/base_reachable_time_ms $ echo 30 > /proc/sys/net/ipv4/route/gc_interval