Tuesday 22 June 2004

Nokia M11 Interface Address via SNMP

I used to use a Nokia M11 to connect to the Internet. The M11 acts as a router, so the IP address of the router on the Internet bore no resemblance to the IP address of my computer. However, I needed that external address to send to DynDNS.org.

The M11 supports SNMP, so I wrote a short shell script using NET-SNMP. It finds the external IP address in two steps:

  1. Loop through the network interface descriptions under ifDescr to find the ifIndex of the PPP interface.

  2. Loop through the IP addresses under ipAdEntIfIndex to find the matching index, and get the IP address of the selected interface from ipAdEntAddr.

The command line syntax has probably changed since I used this program, so you might need to make some minor changes.