[ previous ] [ next ] [ threads ]
 
 From:  Adam Armstrong <lists at memetic dot org>
 To:  Aaron Cherman <aaronc at morad dot ab dot ca>, Monowall User List <m0n0wall at lists dot m0n0 dot ch>
 Subject:  Re: [m0n0wall] SNMP OID for Interface IP Address
 Date:  Mon, 08 Jun 2009 22:57:17 +0100
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.
>
> Aaron
>   
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.87.244.103.66 = INTEGER: 2

and then ipAdEntNetMask :

IP-MIB::ipAdEntNetMask.87.244.103.66 = IpAddress: 255.255.255.248

Hope that helps!

adam.