TechTip: Force Remote Host to clear ARP Cache
I am sure you must have seen the problem when you changed the IP address of the computer host, and the host went off the network. The reason is pretty simple that the router haven’t go the updated it’s arp table with the right Mac address and IP address combination, means the old IP address is still associated with the Mac address of your system. Usually this is taken care automatically but sometimes if it’s not happening then there is a way to fix this, by forcing the router to update it’s arp table.
Normally the Arp cache persists in the router till following things happen:
- The Arp cache expires in the router
- The host updates the router about the change in IP address
- The Arp cache is manually cleared.
If you have admin access to the router then you can use different commands to clear the cache, but problem is when you don’t have access to the router. In those scenarios “arping” is the command which can be useful.
Here is my routing table:
`–> netstat -rn
Routing tables
Internet:
Destination Gateway Flags Refs Use Netif
default 192.168.1.127 UGSc 1 203 en0
10.31.33/24 10.8.0.5 UGSc 1 0 tun0
127 127.0.0.1 UCS 0 0 lo0
127.0.0.1 127.0.0.1 UH 5 1748535 lo0
128.0/1 10.8.0.5 UGSc 5 0 tun0
This says that my gateway is 192.168.1.127. After changing the IP address use “arping” like this.
$ arping -c 1 192.168.1.127
ARPING 192.168.1.127 60 bytes from 00:45:40:sd:h6:12 (192.168.1.127): index=0 time=13.884 msec --- 192.168.1.127 statistics --- 1 packets transmitted, 1 packets received, 0% unanswered