MoonPoint Support Logo

 


Shop Amazon Warehouse Deals - Deep Discounts on Open-box and Used ProductsAmazon Warehouse Deals



Advanced Search
February
Sun Mon Tue Wed Thu Fri Sat
      1
       
2006
Months
Feb


Wed, Feb 01, 2006 6:49 pm

Get ARP Table

I needed to be able to get the ARP table from Cisco devices, so I created get_arp, a Perl script which will query a router, switch, etc. via SNMP and obtain the ARP table from the device. There are two mandatory arguments for the script, the hostname or IP address for the device and the read-only community string for the device. If given only those two arguments, the script will produce output similar to what is shown below:
% ./get_arp 192.168.220.76 tViSoN1a
ARP table for 192.168.220.76 on Wed Feb  1 22:21:38 2006

192.168.220.65 = 0:30:f2:ec:17:fc
192.168.220.66 = 0:30:f2:ec:8b:fc
192.168.220.67 = 0:30:f2:ec:17:ff
192.168.220.68 = 0:30:f2:ec:8b:ff
192.168.220.69 = 0:90:b1:81:e9:0
192.168.220.70 = 0:60:3e:7e:c7:40
192.168.220.75 = 0:9:b7:7d:e6:0
192.168.220.76 = 0:60:3e:7e:1e:a0
192.168.220.77 = 0:f:f7:5b:b:0
192.168.220.78 = 0:f:f7:5d:64:f0

An optional argument "--nomac" will cause the script to only display the IP addresses in the ARP table, not the MAC addresses associated with the IP addresses as shown below:

% ./get_arp --nomac 192.168.220.76 tViSoN1a
ARP table for 192.168.220.76 on Wed Feb  1 22:21:49 2006

192.168.220.65
192.168.220.66
192.168.220.67
192.168.220.68
192.168.220.69
192.168.220.70
192.168.220.75
192.168.220.76
192.168.220.77
192.168.220.78

To use the script, download the script and use chmod 744 to make the script executable by the owner. Modify the first line, if Perl is located somewhere else on your system, which you can determine by the command which perl. The script relies on the snmpwalk utility, which is available from http://www.net-snmp.org/. You can determine if it is available on your system already by issuing the command which snmpwalk.

[/network/snmp] permanent link

Once You Know, You Newegg AliExpress by Alibaba.com

Shop Amazon Local - Subscribe to Deals in Your Neighborhood

Valid HTML 4.01 Transitional

Privacy Policy   Contact

Blosxom logo