1833869 Members
1710 Online
110063 Solutions
New Discussion

arp

 
esha
Occasional Contributor

arp

is there any arp command that can flush all arp entries in one go
4 REPLIES 4
A. Clay Stephenson
Acclaimed Contributor

Re: arp

No, but it would be rather easy to do an arp -a and pipe the output to awk or perl to supply a series of arp -d hostname commands. It would be a very easy (if dangerous) script to write.
If it ain't broke, I can fix that.
Steven E. Protter
Exalted Contributor

Re: arp

Shalom,

You could reboot the box or stop networking for a minutes. Either solution would clearly clear the arp table.

man arp

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
spex
Honored Contributor

Re: arp

As Clay said, very dangerous:

#!/usr/bin/sh

for i in $(arp -a | awk '{print $1}')
do
arp -d $i
done

From 'man arp':
-d: This option cannot be used to delete a permanent ARP entry whose IP address is an interface on the local system.

So the entries of local interfaces should remain.

PCS
rick jones
Honored Contributor

Re: arp

Of course, all this beggs the question:

Why do you want to flush the ARP cache?

there is no rest for the wicked yet the virtuous have no pillows