Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Getting port mappings and DHCP usage from an Airport Device' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Getting port mappings and DHCP usage from an Airport Device
Authored by: mike_savory on Jan 04, '12 03:55:54PM

Also to get live information, you can enable SNMP on an Airport (I recommend not enabling SNMP over the WAN as this is then a security hole) on the Advanced Tab under Logging and Statistics. For this example I have set my community string to "secret", you should obviously use something more secure.

SNMP is a very old Internet Protocol for reading values and tables from a heirachical database (called a MIB) over IP. For a general description of SNMP and MIB's check out Wikipedia.

Luckily OSX already ships with a built in SNMP command-line tool and with a custom MIB for the Airport already installed by Apple. The MIB is located at
/usr/share/snmp/mibs/AIRPORT-BASESTATION-3-MIB.txt

Full details of the CLI tool can be found at http://www.net-snmp.org/
Lion ships with version 5.6, if you are a macports user (http://www.macports.org/) you can easily upgade to the latest version 5.7.1 using the command "sudo port install net-snmp".

Reading the MIB is a very geeky thing to do, and its sometimes just easier to walk the whole MIB to look for what you want. Here I'll just give you a few examples.

$ snmpwalk -v2c -csecret -M/usr/share/snmp/mibs -mALL 10.0.3.1 dhcpIpAddress
AIRPORT-BASESTATION-3-MIB::dhcpIpAddress."00:00:CD:1D:92:93" = IpAddress: 10.0.3.31
AIRPORT-BASESTATION-3-MIB::dhcpIpAddress."00:0C:29:66:31:CA" = IpAddress: 10.0.3.53
AIRPORT-BASESTATION-3-MIB::dhcpIpAddress."00:11:24:95:53:F8" = IpAddress: 10.0.3.26
AIRPORT-BASESTATION-3-MIB::dhcpIpAddress."00:11:24:EC:08:5B" = IpAddress: 10.0.3.13
AIRPORT-BASESTATION-3-MIB::dhcpIpAddress."00:17:F2:E6:75:75" = IpAddress: 10.0.3.36
AIRPORT-BASESTATION-3-MIB::dhcpIpAddress."00:23:6C:90:08:B9" = IpAddress: 10.0.3.10
AIRPORT-BASESTATION-3-MIB::dhcpIpAddress."00:24:36:F1:38:0C" = IpAddress: 10.0.3.20

So the command I used was "snmpwalk", this steps through a set of values and displays them. The parameter "-v2c" tells snmpwalk to use the 2c version of the protocol, The version 3 of the protocol allows encrypted and authenticated connections, but is more detailed to set up. Most devices will use version 2c. The "-csecret" parameter sets snmpwalk to use the string you set on your airport (note this is not really a password, as it is sent in the clear with every packet). The "-M/usr/share/snmp/mibs" parameter tells snmpwalk to look for MIB's in this directory, and the -mALL tels it to load all the MIB's it finds there. If you dont load the MIB's then snmpwalk will show you the OID number of the variable, rather than the clearer english version. 10.0.3.1 is the IP address of my Airport Extreme (yours will of course be different). And the final parameter tells snmpwalk to show me the dhcpIpAddress table (I found this name in the MIB).

To see everyting the special Apple MIB (called an Enterprise MIB) contains you should use the command

$ snmpwalk -v2c -csecret -M/usr/share/snmp/mibs -mALL 10.0.3.1 enterprises

To see all the standard MIB's supported try

$ snmpwalk -v2c -csecret -M/usr/share/snmp/mibs -mALL 10.0.3.1

In these standard MIB's are thinks like port speeds and port counters. This opens up opportunities for monitorng almost every aspect of the operation of you device, and this is not ust limited to Airort Extremes, most internet switches and routers (and even servers) can be monitored via SNMP.

Searching through here I was not able to find the static port-maps, but that is more of a configuration setting rather than running state information like DHCP leases.




[ Reply to This | # ]