Solved

Flushing the arp table

Posted on 2000-03-22
7
15,158 Views
Last Modified: 2010-05-18
How do you flush the arp table.  Do you have to do it one entry at a time, or can you just ditch the whole thing at once?

Thanks,
Bret
0
Comment
Question by:badreece
7 Comments
 
LVL 1

Expert Comment

by:bhagawatula
ID: 2646216
What OS?
On HPUX and Solaris :
try route -f
to flush the table.
I think you need to add your default route again after this.

-f Flush the routing tables of all  gateway  entries.
    If  this  is  used  in conjunction with one of the     commands described above, route  flushes the gate-ways before performing the command.  

0
 

Expert Comment

by:thacsi
ID: 2646648
arp -d hostname

You could build a wrapper script to first get all hostnames with arp -a and then remove them with arp -d.

0
 
LVL 1

Expert Comment

by:dserna
ID: 2646686
What Unix are we talking about here? If you are interested to know on how to flush the arp table in Solaris, this is the way you would do it:

as root:

: root@ns:/export/home/dserna2: arp -a
Net to Media Table
Device   IP Address               Mask      Flags   Phys Addr
------ -------------------- --------------- ----- ---------------
le0    209.220.74.1         255.255.255.255       00:10:67:00:3f:80
le0    ns                   255.255.255.255 SP    08:00:20:75:e9:29
le0    BASE-ADDRESS.MCAST.NET 240.0.0.0       SM    01:00:5e:00:00:00
: root@ns:/export/home/dserna2: ifconfig -a
lo0: flags=849<UP,LOOPBACK,RUNNING,MULTICAST> mtu 8232
    inet 127.0.0.1 netmask ff000000
le0: flags=863<UP,BROADCAST,NOTRAILERS,RUNNING,MULTICAST> mtu 1500
    inet 209.220.74.121 netmask ffffff00 broadcast 209.220.74.255
    ether 8:0:20:75:e9:29
: root@ns:/export/home/dserna2: ifconfig le0 209.220.74.121 ; arp -a
Net to Media Table
Device   IP Address               Mask      Flags   Phys Addr
------ -------------------- --------------- ----- ---------------
le0    ns                   255.255.255.255 SP    08:00:20:75:e9:29
le0    BASE-ADDRESS.MCAST.NET 240.0.0.0       SM    01:00:5e:00:00:00
: root@ns:/export/home/dserna2:



I don't know about other Unix versions. Hope that helps.
0
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
LVL 2

Expert Comment

by:festive
ID: 2647784
regardless of what version the following could be adapted:
 below should work for solaris on le0 interface

for arpent in `arp -a | grep "^le0" ` ; do
     arp -d $arpent
done

you could specify multiple/all interfaces by substituting grep with egrep and using the following:
egrep "^le0|^hme0|^net0"

etc...

0
 
LVL 2

Expert Comment

by:festive
ID: 2647792
regardless of what version the following could be adapted:
 below should work for solaris on le0 interface

for arpent in `arp -a | grep "^le0" | awk ''{ print $2 }' ` ; do
     arp -d $arpent
done

you could specify multiple/all interfaces by substituting grep with egrep and using the following:
egrep "^le0|^hme0|^net0"

etc...

0
 
LVL 2

Accepted Solution

by:
festive earned 50 total points
ID: 2647797
regardless of what version the following could be adapted:
 below should work for solaris on le0 interface

for arpent in `arp -a | grep "^le0" | awk ''{ print $2 }' ` ; do
     arp -d $arpent
done

you could specify multiple/all interfaces by substituting grep with egrep and us
ing the following:
egrep "^le0|^hme0|^net0"

etc...
0
 

Author Comment

by:badreece
ID: 2649648
That's going to work for me.
Thanks,
Bret
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In tuning file systems on the Solaris Operating System, changing some parameters of a file system usually destroys the data on it. For instance, changing the cache segment block size in the volume of a T3 requires that you delete the existing volu…
Introduction Regular patching is part of a system administrator's tasks. However, many patches require that the system be in single-user mode before they can be installed. A cluster patch in particular can take quite a while to apply if the machine…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question