5
  • How to clear arp cache ?
  • How to refresh arp table ?
Kumar
  • 823
  • 3
  • 20
  • 43

2 Answers2

6

How to refresh arp table ?

You can save ip from arp table:

arp -an | sed -s 's/.*(\([0-9.]*\)).*/\1/' > /tmp/ip_to_arp

And then ping all ip:

for ip in `cat /tmp/ip_to_arp`; do ping -c 1 ${ip}; done

or

for ip in `cat /tmp/ip_to_arp`; do arping -c 1 -I eth0 ${ip}; done
alvosu
  • 8,357
  • 24
  • 22
  • Can I use your script in my weblog? http://pahlevanzadeh.org , I write about freesoftware and unix, linux and programming in the freesoftware world.... of course in Persian... – PersianGulf Sep 22 '15 at 23:26
5
arp -da

Then it's autorefreshing. :-)

poige
  • 9,171
  • 2
  • 24
  • 50