Aaron Cherman wrote:
> Is there any way to use SNMP to poll an OID to find an interface's IP address?
> I use a simple ADSL connection for a backup for our alarms. So I open up our main m0n0wall (on
fiber) to allow pings from the ADSL m0n0wall, but it uses DHCP and every once in a while the ISP
screws with things and we end up getting assigned a new address (on a new subnet too). Of course
the fiber m0n0wall won't permit pings from that address and it appears to be down. I have to redo
the permit rule and routing info for the new subnet/address. I'd like to monitor the IP address on
the WAN interface and if it changes I can trigger an alert.
> Any ideas? I done and SNMP walk and do see the address listed, but it appears in a table with the
row ID being the address itself. Weird.
> Thanks in advance.
You need to work out what ifIndex is for each interface, so walk ifDescr:
IF-MIB::ifDescr.2 = STRING: eth0
Then you need to walk ipAdEntIfIndex :
IP-MIB::ipAdEntIfIndex.22.214.171.124 = INTEGER: 2
and then ipAdEntNetMask :
IP-MIB::ipAdEntNetMask.126.96.36.199 = IpAddress: 255.255.255.248
Hope that helps!