Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements

Welcome to Cisco Support Community. We would love to have your feedback.

For an introduction to the new site, click here. And see here for current known issues.

New Member

SNMP: How to get list of IP addresses and corresponding interface names

Hello,

i have list of IP addresses of interfaces of router. I need to get the corresponding interface names (e.g. fa0/0) so that i can match them with the list of ip addresses (e.g. i have ip 192.168.1.1 and i need to find out that it is IP of fa0/0). Is there any MIB in SNMP which can be utilized for that purpose?

Thank you very much.

jakub

Everyone's tags (1)
3 REPLIES
Cisco Employee

SNMP: How to get list of IP addresses and corresponding interfac

Hi Jakub,

* you can use  IP-MIB object ipAdEntIfIndex (1.3.6.1.2.1.4.20.1.2) to identify IP Address. for a specific interface and its ifIndex.  Again, these interface ifIndices can be translated through ifDescr (1.3.6.1.2.1.2.2.1.2) to map the specific interface description.

ipAdEntIfIndex (1.3.6.1.2.1.4.20.1.2)

Description    "The index value which uniquely identifies the interface to which this entry is applicable. The interface identified by a particular value of this index is the same interface as identified by the same value of the IF-MIB's ifIndex."

For example :

snmpwalk -v2c -c private 10.104.149.18 1.3.6.1.2.1.4.20.1.2    <<=== ipAdEntIfIndex

   IP-MIB::ipAdEntIfIndex.1.1.1.231 = INTEGER: 108

   IP-MIB::ipAdEntIfIndex.2.2.2.1 = INTEGER: 157

   IP-MIB::ipAdEntIfIndex.7.7.7.100 = INTEGER: 107

IP-MIB::ipAdEntIfIndex.10.104.149.18 = INTEGER: 78      ====>> 78 is Management

Interface (Vlan1) ifIndex

   IP-MIB::ipAdEntIfIndex.11.11.1.1 = INTEGER: 91

   IP-MIB::ipAdEntIfIndex.11.11.2.2 = INTEGER: 92

   IP-MIB::ipAdEntIfIndex.11.11.3.3 = INTEGER: 93

   IP-MIB::ipAdEntIfIndex.51.51.51.2 = INTEGER: 100

   IP-MIB::ipAdEntIfIndex.55.55.55.2 = INTEGER: 101

   IP-MIB::ipAdEntIfIndex.61.61.61.1 = INTEGER: 102

   IP-MIB::ipAdEntIfIndex.65.65.65.5 = INTEGER: 103

   IP-MIB::ipAdEntIfIndex.79.161.80.43 = INTEGER: 109

   IP-MIB::ipAdEntIfIndex.99.1.1.1 = INTEGER: 5

   IP-MIB::ipAdEntIfIndex.100.1.1.1 = INTEGER: 160

   IP-MIB::ipAdEntIfIndex.127.0.0.51 = INTEGER: 79

   IP-MIB::ipAdEntIfIndex.192.168.10.1 = INTEGER: 105

   $

* The above result shows the IP addresses associated with different ifindex(es).To check which ifindex is associated with each interface, you can use the ifDescr (1.3.6.1.2.1.2.2.1.2) OID.

   $ snmpwalk -v2c -c private 10.104.149.18 ifDescr

   IF-MIB::ifDescr.1 = STRING: GigabitEthernet1/1

   IF-MIB::ifDescr.2 = STRING: GigabitEthernet1/2

   ��..

   ��..

   IF-MIB::ifDescr.77 = STRING: GigabitEthernet9/8

   IF-MIB::ifDescr.78 = STRING: Vlan1      <<===  Management Interface (Vlan1) IfIndex is 78

   IF-MIB::ifDescr.79 = STRING: EOBC0/0

   IF-MIB::ifDescr.80 = STRING: Null0

Thanks-
Afroz
[Do rate the useful post]
****Ratings Encourages Contributors ****

Thanks- Afroz [Do rate the useful post] ****Ratings Encourages Contributors ****
New Member

SNMP: How to get list of IP addresses and corresponding interfac

Its is very helpful! Thanks...

Cisco Employee

SNMP: How to get list of IP addresses and corresponding interfac

Glad , it helped you 

Thanks-
Afroz
[Do rate the useful post]
****Ratings Encourages Contributors ****

Thanks- Afroz [Do rate the useful post] ****Ratings Encourages Contributors ****
4804
Views
5
Helpful
3
Replies
CreatePlease login to create content