Section 11.11. Wireless Networking


11.11. Wireless Networking

This section will show how to gather management statistics from wireless access points using the 802.11 MIB. The IEEE 802.11 MIB is freely available from many sites, including http://www.cs.ucla.edu/~hywong1/doc/IEEE802dot11-MIB.my. The MIB itself is pretty dense. A detailed discussion of this MIB is beyond the scope of this chapter. Instead, we will present a script that can gather certain data points from your WAP. Consider the following script.

     #!/usr/bin/perl     use SNMP;     $SNMP::use_sprint_value = 1;     &SNMP::loadModules('IEEE802dot11-MIB');     my $host = "192.168.1.4";     my $sess = new SNMP::Session(DestHost => $host,                                     Version => 2,                                     Community => "public");     my %wapStats;     my $var = new SNMP::Varbind(['dot11CurrentChannel']);     do {       $val = $sess->getnext($var);       my $channel = $var->[$SNMP::Varbind::val_f];       my $ifIndex = $var->[$SNMP::Varbind::iid_f];       my($ssid, $mac, $manufacturer, $model, $rtsFailureCount,       $ackFailureCount, $fcsErrorCount) = $sess->get([             ['dot11DesiredSSID',$ifIndex],             ['dot11MACAddress',$ifIndex],             ['dot11ManufacturerID',$ifIndex],             ['dot11ProductID',$ifIndex],             ['dot11RTSFailureCount',$ifIndex],             ['dot11ACKFailureCount',$ifIndex],             ['dot11FCSErrorCount',$ifIndex]             ]);       $wapStats{$ifIndex} = "$channel,$ssid,$mac,$manufacturer,"       $wapStats{$ifIndex} .= "$model,$rtsFailureCount,$ackFailureCount,$fcs     ErrorCount";     }unless($sess->{ErrorNum});     foreach my $key (sort keys %wapStats){             my($channel, $ssid, $mac, $manufacturer, $model,             $rtsFailureCount, $ackFailureCount, $fcsErrorCount) =                     split(/,/,$wapStats{$key});             print "WAP $ssid with MAC Address $mac (Manufacturer: $manufacturer,     Model: $model, Channel: $channel, ifIndex: $key)\n";             print "\tdot11RTSFailureCount: $rtsFailureCount\n";             print "\tdot11ACKFailureCount: $ackFailureCount\n";             print "\tdot11FCSErrorCount: $fcsErrorCount\n";     } 

First, notice that we're using the Net-SNMP Perl module. Second, note the MIB module we load:

     &SNMP::loadModules('IEEE802dot11-MIB'); 

This is critical. It allows us to use textual object names in the script as opposed to numeric OIDs. The first thing we do is set up a variable binding for dot11CurrentChannel. This is defined in the 802.11 MIB as:

     dot11CurrentChannel OBJECT-TYPE             SYNTAX INTEGER (1..14)             MAX-ACCESS read-write             STATUS current             DESCRIPTION                 "The current operating frequency channel of the DSSS                 PHY. Valid channel numbers are as defined in 15.4.6.2"         ::= {   dot11PhyDSSSEntry 1 } 

This is the channel ID currently in use. This entry is in a table that contains other objects. We're concerned only with the channel right now. Also note that this table is indexed by ifIndex, which is the same object you might remember from the interfaces subtree. We perform a getnext on this object that returns the channel and the ifIndex. We then perform a get of seven objects. The first four are the SSID, MAC address, manufacturer ID, and product ID, respectively. The remaining three may seem obscure. It will become apparent why we chose these in a few moments. First, here are the last three objects from the MIB:

     dot11RTSFailureCount OBJECT-TYPE             SYNTAX Counter32             MAX-ACCESS read-only             STATUS current             DESCRIPTION             "This counter shall increment when a CTS is not received in             response to an RTS."         ::= { dot11CountersEntry 8 }     dot11ACKFailureCount OBJECT-TYPE             SYNTAX Counter32             MAX-ACCESS read-only             STATUS current             DESCRIPTION                 "This counter shall increment when an ACK is not received                 when expected."         ::= {  dot11CountersEntry 9 }     dot11FCSErrorCount OBJECT-TYPE             SYNTAX Counter32             MAX-ACCESS read-only             STATUS current             DESCRIPTION                 "This counter shall increment when an FCS error is                 detected in a received MPDU."         ::= {  dot11CountersEntry 12 } 

Before we expand on these objects, let's look at the output from this script:

     $ ./wapstats.pl     WAP "thehouse2" with MAC Address 0:f:b5:3:fd:6f (Manufacturer: NETGEAR, Model:     WG302, Channel: 10, ifIndex: 1)             dot11RTSFailureCount: 0             dot11ACKFailureCount: 0             dot11FCSErrorCount: 0 

As you can see, we get some identifying information for WAP. Of course, you can expand on this script and gather other parts of the 802.11 MIB or other statistics from the interfaces MIB.

Now, what about these three objects? The first one, dot11RTSFailureCount, basically means that a clear to send (CTS) was never received when a ready to send (RTS) was sent. dot11ACKFailureCount, according to Matthew Gast, author of O'Reilly's 802.11 Wireless Networks: The Definitive Guide, "directly tracks the number of inbound acknowledgments lost. Whenever a frame is transmitted that should be acknowledged, and the acknowledgment is not forthcoming, this counter is incremented." dot11FCSErrorCount is the frame check sequence (FCS) error count. Basically, the FCS is extra padding in a frame for error control. If this count ever goes up, it could be indicative of problems with the base station subsystem (BSS)i.e., the radio-related functions of a WAP. As these descriptions imply, these three objects are indicators that something bad is happening.

While at the University of California, Santa Cruz, Max Baker proposed a way of automatically setting a WAP's channel based on a score. The score is made up of the three aforementioned objects. The score he proposes is:

     Score = .2 * FCS Errors + .4 * RTS Failures + .4 * ACK Failures 

We can add that score to our script with the following subroutine:

     sub scoreChannel {       my($rtsFailureCount, $ackFailureCount, $fcsErrorCount) = @_;       return (.2 * $fcsErrorCount + .4 * $rtsFailureCount +         .4 * $ackFailureCount);     } 

Let's run the stats script again with that addition:

     $ ./wapstats.pl     WAP "thehouse2" with MAC Address 0:f:b5:3:fd:6f (Manufacturer: NETGEAR, Model:     WG302, Channel: 10, ifIndex: 1)             dot11RTSFailureCount: 0             dot11ACKFailureCount: 0             dot11FCSErrorCount: 0             Channel score: 0 

The lower the score, the better. We can find the lowest-scoring channel in one of two ways:

  • Actively monitoring the WAP over time and noting the score for a given channel. The problem with this technique is that you must periodically change the channel number so that other wireless devices can pick it up and begin using it. You then need to monitor these error indicator variables for some period of time, change the channel setting, let people connect to the new channel, gather error variables for a period of time, and keep doing this for as many channels as you can set on your WAP. Changing the channel can also be done via SNMP (more on this in a second).

  • Changing the channels, via SNMP, and sitting on each one for about a minute (this is the solution Max proposes). After the minute is up, gather the stats, calculate the score, and move on to the next one. Once you are done, figure out which channel has the lowest score and set the WAP to this channel. The issue with this approach is that you have to coordinate the changing of the channels with someone or something finding the new channel setting and using it. It's similar to the first approach, but since you are monitoring each channel for a brief period, you may want to somehow automate the device that does the actual connection. Note that wireless cards are capable of finding a new channel automatically.

Once you find the lowest-scoring channel, you can force the WAP to use that channel by using the same object we used to discover the channel in the first place: dot11CurrentChannel. The following code can be used to set a new channel for a WAP:

     $sess->set([['dot11CurrentChannel',$ifIndex,$newChannel,"INTEGER"]]); 

Even wireless devices can be managed via SNMP. With some creativity and thought, you can bring your WAPs into your network management architecture and manage them effectively.




Essential SNMP
Essential SNMP, Second Edition
ISBN: 0596008406
EAN: 2147483647
Year: 2003
Pages: 165

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net