How to clear ARP cache
The command arp is used to modify the system’s kernel arp cache. ARP stands for Address Resolution Protocol and maps a specific IP address to its MAC address. Each system on a network will have a unique IP address and a unique MAC address. Since the raw network packets understand the MAC addressing, it is necessary to use ARP in networking.
When we request to access a hostname such as mysite.com which is in same local network. The hostname is converted to its IP address for example 1.2.3.4 using DNS. On getting the IP address, ARP announces to the network to provide it with the MAC address of the IP address 1.2.3.4. When the system gets the MAC address, it stores the MAC address to IP address maping in its ARP cache. Until a change is forced or the ARP cache expires. When we need to contact a external site, then the system reaches the router and stores the mapping in its ARP cache.
This command can be used when you are having problem with your network such as the MAC address associated with a IP address is incomplete or wrong. In this scenario, you will have to clear the ARP cache and try to connect to the device again. This will regenerate the ARP cache.
Here are examples on how to use arp command.
To view the systems’s ARP cache
arp -a
Output:
(192.168.2.1) at 96:44:52:3a:c4:b1 [ether] on eth0
The above line means that the MAC address of the network device with IP address 192.168.2.1 is 96:44:52:3a:c4:b1. Basically 192.168.2.1
To delete a ARP entry and to clear ARP Cache
arp -d <IP address>
Replace IP address with the actual IP address of the entry you want to delete. Use this with caution since deleting the wrong entry will leave your system with wrong network configuration.
To add a entry to the ARP table
arp -s <IP address> <MAC address>
A real life example is as follows.
arp -s 192.168.2.1 96:44:52:3a:c4:b1
ARP can be a real useful tool when you can see that on sending a request to a network device using ping, ftp or other network tools is resulting in response from some other IP address. This shows corruption of the ARP cache.
Now you know what to do when the ARP is causing issues.
No related posts.
Category: Linux, Software, Technology














For a large Arp table, here are few more examples
Display arp results only for one host
arp -a hostname
If you have multiple network card, you can see the arp table for a specific card
arp -i eth0
arp -n will display only IP without resolving hostnames.
Cheers