[c-nsp] Getting ARP table from SNMP
Drew Weaver
drew.weaver at thenap.com
Tue Oct 17 16:31:55 EDT 2006
http://www.systemadminihater.com/sharper.tar.gz
Give it an IP address and it returns output such as:
The server Drew's Server (192.168.0.2) attached to Fa3/13(Vlan313) on
Switch1 (192.168.0.1) has the mac address of 00 07 E9 43 3C 9E
Enjoy it as much as I enjoyed writing it :D
-Drew
-----Original Message-----
From: cisco-nsp-bounces at puck.nether.net
[mailto:cisco-nsp-bounces at puck.nether.net] On Behalf Of Laurent Geyer
Sent: Tuesday, October 17, 2006 11:18 AM
To: Drew Weaver
Cc: cisco-nsp at puck.nether.net
Subject: Re: [c-nsp] Getting ARP table from SNMP
On 10/16/06, Drew Weaver <drew.weaver at thenap.com> wrote:
>
> Hi there, I read the archives and I found a similarly titled post
> from some time ago, I am wondering if since that time any improvements
> or additions have been added that may help me.
>
> Basically I am looking for the functionality in which I can supply an
> IP address to my switch via SNMP and it will return the mac address
> which it is sending ARP requests for that IP address.. so far this is
> what I
> have:
>
> [root at nessie ~]# snmpget -v2c -c community switch
> .iso.org.dod.internet.mgmt.mib2.at.atTable.atEntry.atPhysAddress.376.1
> .1
> 92.168.0.1
>
>
> RFC1213-MIB::atPhysAddress.376.1.192.168.0.1 = Hex-STRING: 00 90 7F 32
> 90 92
>
> the problem I have with the above is simply that I do not know the
> port id (376) beforehand, so is there anyway to simply send the IP
address?
A bit messy maybe, but you could just do a snmp bulk walk on
atPhysAddress (
1.3.6.1.2.1.3.1.1.2) and grep for the IP address.
Something like this should work:
`snmpbulkwalk -v2c -c <community string> <switch/router>
1.3.6.1.2.1.3.1.1.2| grep <IP address>'
Personally, I've written a perl script that walks the ARP table every
now and again and stores the information I'm after in a database. This
way I'm able to observe changes, and maintain a historical view of my
ARP tables with a simple DBI based Perl script.
I'm not much of a programmer but if you're interested I can clean my
code up a bit and send you what I've got.
- Laurent
_______________________________________________
cisco-nsp mailing list cisco-nsp at puck.nether.net
https://puck.nether.net/mailman/listinfo/cisco-nsp
archive at http://puck.nether.net/pipermail/cisco-nsp/
More information about the cisco-nsp
mailing list