Router ARP Cache is Not Releasing Linux / UNIX Server IP address

Q. Recently we made changes to our server hardware and swapped all IP address from old to a new server. However, 2 IP addresses are not get updated due to arp cache issues (IPs are cached on the router). They are going to other servers. How do I solve this problem under Redhat Enterprise Linux version 5.0 or any other Linux distribution?

A. ARP is used to resolve IP address to the corresponding Ethernet address. ARP maintains the mapping between IP address and MAC address in a table in memory called ARP cache. The entries in this table are dynamically added and removed.

This is common and well known problem. Most ISPs and network admin configure their routers with a long ARP cache timeout. As a result your requests are going to other server. If you move IP address it may take hours before server can communicate with the Internet (correct server). To get rid of this problem you need to request the MAC address for its own IP which will cause routers and other hardware update ARP cache. This is called as ‘unsolicited ARP‘ or ‘gratuitous ARP‘.

arping command – To sends an ARP request to resolve its own IP address (gratuitous ARP)

There are two versions of arping, you need a version written by Alexey Kuznetsov. Both Debian and RHEL has Alexey arping command version. Type the following command to update arp cache:
# arping -U -I {Interface-Name} {IP-Address}
# arping -U -I eth1


  • -U : Unsolicited ARP mode to update neighbours’ ARP caches. No replies are expected.
  • -I eth1 : Name of network device where to send ARP REQUEST packets. This is required.
  • : IP address

There is also another tool called send_arp from the High-Availability Linux Project for same purpose.

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 6 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersdf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
6 comments… add one
  • Emil Obermayr Jan 25, 2008 @ 12:16

    You can use /sbin/arp with option -a to show the current arp table. And then use option -d to delete the old entry of your server. It will be learned again immediately when needed.

    • Matthew Jul 7, 2010 @ 15:36

      I know this is an ancient post, but I wanted to clear this up:

      Emil, that doesn’t affect your gateway router’s arp table, which is the source of the problem. If you move an IP between two machines, the gateway loses track of where it is, and tries to send traffic for it to the wrong MAC address. This can also affect managed switches to some degree, although not as much. The trick in the post is the equivalent of making your computer say ‘HEY DUMMY! THE IP IS OVER HERE NOW!”

  • Fredrik Liljegren May 25, 2009 @ 18:37

    In debian (lenny) there’s two arping packages: arping and iputils-arping. This article refers to the iputils-arping version.

  • Aaron Couch Jan 29, 2010 @ 17:03

    Thank you Fredrik for mentioning that. I was having a lot of trouble because I was using the Thomas Habets version of ‘arping’ that you get through ‘apt-get install arping’ on debian.

    To install the ‘Alexey Kuznetsov’ version you need to use ‘apt-get install iputils-arping’ which uses the syntax above.

  • Ade B Oct 25, 2010 @ 20:15

    Thanks guys, was having a problem on a hotel network – the router was continually asking for my MAC and never getting a reply from me.

    I used “arping -U -I wlan0” and the network started working a treat

    arping FTW

  • Joe L Jun 6, 2014 @ 18:18

    I ran into this problem on Ubuntu 14.04 where arp was not being updated for ethernet aliases (eth0:0, eth0:1, etc.), while it would work fine for the primary ip address for an interface. At the time we ended up manually setting each alias as the primary, sending out some traffic, and then moving to the next one. The arping command fixes this in a much simpler fashion, without having to change your network settings.

    I ran into the same issue with a RaspberryPi running Raspbian (based on Wheezy). This time I used arping, and it worked great.

    Note the syntax to update the arp using the arping command in Ubuntu (as the arping package– written by Thomas Habets) is as follows:

    # arping -S [-i ]

    One could add an arping for each interface and interface alias into their startup scripts to be sure it always gets updated right away. (/etc/rc.local or a custom script). This is less useful for a server that would rarely move, but might be helpful for laptops, etc.

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum