08-01-2005 09:30 PM
Hi All...
how can I get Ip addres from interfaces router per interface ordem?
I´m using the OID .1.3.6.1.2.1.4.20.1.1, but, when I run snmpwalk, I receive this information:
IP-MIB::ipAdEntIfIndex.1.1.1.6 = INTEGER: 6
IP-MIB::ipAdEntIfIndex.1.1.1.7 = INTEGER: 7
IP-MIB::ipAdEntIfIndex.1.1.1.1 = INTEGER: 1
IP-MIB::ipAdEntIfIndex.1.1.1.2 = INTEGER: 2
IP-MIB::ipAdEntIfIndex.1.1.1.3 = INTEGER: 3
IP-MIB::ipAdEntIfIndex.1.1.1.4 = INTEGER: 4
IP-MIB::ipAdEntIfIndex.1.1.1.5 = INTEGER: 5
this example, the Cisco Router has 7 interfaces.
Are there others OIDs that can I try ?
Thanks
Cassio Gomes
Solved! Go to Solution.
08-04-2005 07:03 PM
Cassio,
You show you did the walk on IpAdEntAddr (1.3.6.1.2.1.4.20.1.1), but for whatever reason the returned results show ipAdEntIfIndex (1.3.6.1.2.1.4.20.1.2).
Either OID will provide you your IP address, in this case you do have 7 interfaces with IP addresses of 1.1.1.1 through 1.1.1.7.
You can cross-reference the INTEGER Number at the end of ipAdEntIfIndex with the interface index number provided with the object ifDescr.# (1.3.6.1.2.1.2.2.1.1) where # is the instance number.
HTH
Steve
08-03-2005 02:11 AM
Hi,
don't know what exactly you want. But if you want
something like "1.1.1.6 = Ethernt0", then you can also snmpwalk "mib-2.interfaces.ifTable.ifDescr" and put the 2 outputs together. The index value you get back from "ipAdEntIfIndex" correspond to the index value of "ifDescr"
HTH
Mark
08-04-2005 01:07 PM
If you just want the IP address, you can try doing an snmpwalk on ipAdEntAddr (.1.3.6.1.2.1.4.20.1.1). Odd, that's the same one you tried, but your name is different than what I see...
dc
08-04-2005 07:03 PM
Cassio,
You show you did the walk on IpAdEntAddr (1.3.6.1.2.1.4.20.1.1), but for whatever reason the returned results show ipAdEntIfIndex (1.3.6.1.2.1.4.20.1.2).
Either OID will provide you your IP address, in this case you do have 7 interfaces with IP addresses of 1.1.1.1 through 1.1.1.7.
You can cross-reference the INTEGER Number at the end of ipAdEntIfIndex with the interface index number provided with the object ifDescr.# (1.3.6.1.2.1.2.2.1.1) where # is the instance number.
HTH
Steve
08-05-2005 03:52 AM
Thanks all...
My problem is with ORDEM, when I run snmpwalk, I receive the IP :
IP-MIB::ipAdEntIfIndex.1.1.1.6 = INTEGER: 6
IP-MIB::ipAdEntIfIndex.1.1.1.7 = INTEGER: 7
IP-MIB::ipAdEntIfIndex.1.1.1.1 = INTEGER: 1
IP-MIB::ipAdEntIfIndex.1.1.1.2 = INTEGER: 2
IP-MIB::ipAdEntIfIndex.1.1.1.3 = INTEGER: 3
IP-MIB::ipAdEntIfIndex.1.1.1.4 = INTEGER: 4
IP-MIB::ipAdEntIfIndex.1.1.1.6 = INTEGER: 5
I need receive in ordem 1,2,3,4,5,6,7 to put information in my database.
To solve this problem I did a script in PHP and it works perfect.
I don´t know why, but with this OID, the interfaces are showed out of sequence.
Thanks....
08-05-2005 06:28 PM
The SNMP agent is supposed to return the information in increasing lexographical order.
If the device is indeed responding out of sequence, then this is a bug.
08-06-2005 07:21 PM
Nadim,
My routers exihibit the same results as Cassio.
Here's a sample of me polling ifDesc
IF-MIB::ifDescr.25 = STRING: FastEthernet0
IF-MIB::ifDescr.26 = STRING: Serial0
IF-MIB::ifDescr.27 = STRING: Serial1
IF-MIB::ifDescr.28 = STRING: Serial2
IF-MIB::ifDescr.29 = STRING: Serial3
IF-MIB::ifDescr.30 = STRING: Null0
IF-MIB::ifDescr.31 = STRING: Loopback0
Then follow that up with a ipAdEntAddr
IP-MIB::ipAdEntAddr.10.10.10.100 = IpAddress: 10.10.10.100
IP-MIB::ipAdEntAddr.192.168.1.1 = IpAddress: 192.168.1.1
IP-MIB::ipAdEntAddr.192.168.253.253 = IpAddress: 192.168.253.253
IP-MIB::ipAdEntAddr.192.168.254.253 = IpAddress: 192.168.254.253
Finally I poll the ipAdEntIfIndex
IP-MIB::ipAdEntIfIndex.10.10.10.100 = INTEGER: 31
IP-MIB::ipAdEntIfIndex.192.168.1.1 = INTEGER: 26
IP-MIB::ipAdEntIfIndex.192.168.253.253 = INTEGER: 25
IP-MIB::ipAdEntIfIndex.192.168.254.253 = INTEGER: 25
It looks like the ifDesc is in lexigraphical order, but the ip address polls are in numerical order.
Steve
08-07-2005 04:16 AM
Hello Steve,
In your case the index is always increasing:
IP-MIB::ipAdEntIfIndex.10.10.10.100
IP-MIB::ipAdEntIfIndex.192.168.1.1
IP-MIB::ipAdEntIfIndex.192.168.253.253
IP-MIB::ipAdEntIfIndex.192.168.254.253
In Cassio's case:
IP-MIB::ipAdEntIfIndex.1.1.1.6
IP-MIB::ipAdEntIfIndex.1.1.1.7
IP-MIB::ipAdEntIfIndex.1.1.1.1 <-- Should be higher than 1.1.1.7
08-07-2005 03:53 PM
Yep--now that you point that out--it makes sense.
Thanks!
Steve
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide