[c-nsp] Cisco SNMP: Get interface VLAN based on IP address
Matlock, Kenneth L
MatlockK at exempla.org
Mon Dec 7 10:38:22 EST 2009
You'll have to do it via 2 snmp calls, but here it is.
First, you need to find the IP in the 'ipNettoMediaNetAddress' table:
snmpwalk -c <community> <switchIP> ipNettoMediaNetAddress | grep <ip
you're searching for>
So if I'm looking for 170.188.71.1, I get the following line:
IP-MIB::ipNetToMediaNetAddress.180.170.188.71.1 = IpAddress:
170.188.71.1
^^^
The interface index is ---------
So once you have the interface index, then you do a
snmpwalk -c <community> <switchip> ifName.<ifindex>
And in my case, that gives:
IF-MIB::ifName.180 = STRING: Vl71
The 'Vl71' is the name for Vlan 71.
I'll leave it as an exercise to the reader to figure out a script to do
it (my scripts are not anything I'm proud of enough to show the world)
:)
Ken Matlock
Network Analyst
Exempla Healthcare
(303) 467-4671
matlockk at exempla.org
-----Original Message-----
From: cisco-nsp-bounces at puck.nether.net
[mailto:cisco-nsp-bounces at puck.nether.net] On Behalf Of Rudy Setiawan
Sent: Sunday, December 06, 2009 11:19 PM
To: cisco-nsp at puck.nether.net
Subject: [c-nsp] Cisco SNMP: Get interface VLAN based on IP address
Hello all,
Is there a way that we can get the interface vlan information based on
IP
address that is attached to that interface vlan via snmp?
Interface Vlan100
ip address 192.168.10.1 255.255.255.0
!
So if I search for 192.168.10.1, I can get the interface vlan?
Thank you
Regards,
Rudy
_______________________________________________
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