Discussion:
How to find IP adress by ifIndex?
Janusz Sobczak
2003-08-28 09:02:04 UTC
Permalink
Hello

How can I find out an IP address of an interface (ethernet or ISDN) of a given IF-MIB::ifIndex?

I have a spool of modems. Connections are made on-demand. All I can see at the moment is that e.g. modem at IF-MIB::ifIndex.2 is up but I don't know what peer it is connected to. Any suggestions?

Regards

Janusz
Lawrence MacIntyre
2003-08-28 10:10:04 UTC
Permalink
Janusz:

You will need information from the IF-MIB and the IP-MIB. Here is an
example from a windows 2k machine. ifNumber.0 gives you the number of
interfaces. Then ifIndex gives you the indexes of the interfaces. The
physical address (indexed by the ifIndex) is ifPhysAddress. Then you
look in the IP-MIB and get match the ipAdEntIfIndex and ipAdEntAddr with
the ifIndex from the IF-MIB.

IF-MIB::ifNumber.0 = INTEGER: 2
IF-MIB::ifIndex.1 = INTEGER: 1
IF-MIB::ifIndex.16777219 = INTEGER: 16777219
IF-MIB::ifPhysAddress.1 = STRING:
IF-MIB::ifPhysAddress.16777219 = STRING: 0:b0:d0:b7:a0:23

IP-MIB::ipAdEntAddr.127.0.0.1 = IpAddress: 127.0.0.1
IP-MIB::ipAdEntAddr.160.91.64.228 = IpAddress: 160.91.64.228
IP-MIB::ipAdEntIfIndex.127.0.0.1 = INTEGER: 1
IP-MIB::ipAdEntIfIndex.160.91.64.228 = INTEGER: 16777219
Post by Janusz Sobczak
Hello
How can I find out an IP address of an interface (ethernet or ISDN) of a given IF-MIB::ifIndex?
I have a spool of modems. Connections are made on-demand. All I can see at the moment is that e.g. modem at IF-MIB::ifIndex.2 is up but I don't know what peer it is connected to. Any suggestions?
Regards
Janusz
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Net-snmp-users mailing list
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
Janusz Sobczak
2003-08-28 10:21:03 UTC
Permalink
Post by Lawrence MacIntyre
You will need information from the IF-MIB and the IP-MIB. Here is an
example from a windows 2k machine. ifNumber.0 gives you the number of
interfaces. Then ifIndex gives you the indexes of the interfaces. The
physical address (indexed by the ifIndex) is ifPhysAddress. Then you
look in the IP-MIB and get match the ipAdEntIfIndex and ipAdEntAddr with
the ifIndex from the IF-MIB.
It does not work with my setup. All ipAdEntIfIndex fields point to a 'dialer' interface - a virtual interface which estabilishes ISDN connections.
Lawrence MacIntyre
2003-08-28 10:35:04 UTC
Permalink
What if you ignore the ipAdEntIfIndex and just look at the ipAdEntAddr
fields, assuming that they are in the same order as the indexes? There
is some danger with this strategy, however. If the interfaces are
virtual and therefore are created and/or destroyed on the fly, you might
get out-of-sync data. This effect should be transient, but could be
troublesome.
Post by Janusz Sobczak
Post by Lawrence MacIntyre
You will need information from the IF-MIB and the IP-MIB. Here is an
example from a windows 2k machine. ifNumber.0 gives you the number of
interfaces. Then ifIndex gives you the indexes of the interfaces. The
physical address (indexed by the ifIndex) is ifPhysAddress. Then you
look in the IP-MIB and get match the ipAdEntIfIndex and ipAdEntAddr with
the ifIndex from the IF-MIB.
It does not work with my setup. All ipAdEntIfIndex fields point to a 'dialer' interface - a virtual interface which estabilishes ISDN connections.
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Net-snmp-users mailing list
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
Dave Shield
2003-08-28 10:29:04 UTC
Permalink
Post by Janusz Sobczak
How can I find out an IP address of an interface (ethernet or ISDN) of a
given IF-MIB::ifIndex?
Walk the IF-MIB::ipAdEntIfIndex column.
The index of the instance that matches your ifIndex value will be the
desired IP address.

Dave
Loading...