Centralized WAP Management Without A Controller (telnet)

Say for example, the past several years  you’ve been gradually deploying WAPs throughout your network infrastructure to the point of now warranting the use of a wireless controller to reduce management overhead.  You never expected your wireless infrastructure to have grown so  large, thus many of the WAPs currently deployed do not support a wireless controller and you’re now considering replacement of your entire wireless infrastructure. 

Unfortunately, the cost associated with updating or replacing an entire wireless infrastructure or even the costs of a controller alone often outweigh the management overhead reduction causing the project to be put on hold or rejected.

The use of a wireless controller typically requires that you’ve had some type of WAP standardization protocol in effect so that the WAPs you’ve been deploying are through the same vendor and the same model or family.  Even then, it’s usually only those identified as “enterprise grade” that include support for a controller often leaving IT professionals out of luck.

If you’re lucky enough to have been deploying WAPs that support remote management through telnet or SSH, you can avoid the costs of purchasing a controller by using telnet or ssh.  In this example, the following script will add a list of mac addresses to the filtering lists of D-LINK 2800 and 2590 series access points.  This script can be integrated into an intranet or other utility for easily adding new devices across your wireless infrastructure without having to manually logon to each WAP.

APLIST.txt (list of WAPs and their model)

192.168.42.249 AP2590
192.168.42.254 AP2800
192.168.64.240 AP2590
192.168.64.241 AP2800

MACLIST.txt (list of mac addresses to add)

00:26:XX:XX:XX:18
00:1B:XX:XX:XX:92
10:0B:XX:XX:XX:6C
00:18:XX:XX:XX:F1
00:18:XX:XX:XX:8D

addmac.sh

#!/bin/sh
# addmac.sh
aplist=APLIST.txt
maclist=MACLIST.txt
USER="admin"
PW="PASSWORD"
 
function AP2800() {
        if [ "$1" ]; then
          echo
          echo "Attempting to add $2 to $1 (AP2800).."
          sleep 1
 
              CMD="telnet $1"
              expect -c "
              match_max 100000
              spawn $CMD
 
              expect {
                \"login\" {
                send \"$USER\r\"
                exp_continue
                }
                \"Password:\" {
                send \"$PW\r\"
                exp_continue
                }
                \">\" {
                send \"config wlan 1\r\"
                exp_continue
                }
                 \"wlan\" {
                send \"set acl allow $2\r\quit\r\"
                exp_continue
                expect -re \">\"
                }
              }
              "
        else
          echo "Missing hostname.."
        fi
}
 
function AP2590() {
        if [ "$1" ]; then
          echo
          echo "Attempting to add $2 to $1 (AP2590).."
          sleep 1
 
              CMD="telnet $1"
              expect -c "
              match_max 100000
              spawn $CMD
 
              expect {
                \"login\" {
                send \"$USER\r\"
                exp_continue
                }
                \"Password:\" {
                send \"$PW\r\"
                exp_continue
                }
                 \">\" {
                send \"set macaddradd $2\r\set apply\r\exit\r\"
                exp_continue
                expect -re \">\"
               }
              }
              "
        else
          echo "Missing hostname.."
        fi
}
echo Starting, please wait..
cat $aplist | (
        read IP TYPE
 
        while test "$IP" != ""
        do
                if test "$TYPE" = "AP2800"
                then
                       if [ "$1" ]; then
                                AP2800 $IP $1
                       else
                                cat $maclist| (
                                        read MACADDR
 
                                        while test "$MACADDR" != ""
                                        do
                                                AP2800 $IP $MACADDR
                                                read MACADDR
                                        done
                                )
                        fi
                fi
 
                if test "$TYPE" = "AP2590"
                then
                        if [ "$1" ]; then
                                AP2590 $IP $1
                        else
                                cat $maclist| (
                                        read MACADDR
 
                                        while test "$MACADDR" != ""
                                        do
                                                AP2590 $IP $MACADDR
                                                read MACADDR
                                        done
                                )
                       fi
                fi
        sleep 1
        read IP TYPE
 
        done
        )
echo Finished!
exit 0

Leave a Reply

Your email address will not be published. Required fields are marked *