Search This Blog

Monday 21 February 2011

Clearing LWAPP configs

Thanks to Jason Boyers for this great info on clearing those annoying configs!

One issue I’ve run into both in studying for the ccie wireless lab, and now in developing training material, is how to completely clear the configuration on a lightweight AP.  In the “old” days, you would write erase the IOS configuration, reboot, and BAM – you had a clean slate to work from.  However, the pesky LAPs keep the IP addresses of previously joined WLCs and other WLCs in the same mobility group in NVRAM.  So, what do you do?  There is that command, clear ap-config AP_Name that you can run from the CLI of the WLC, if it’s joined to a WLC.



(Cisco Controller) >clear ap-config LWAP1
clear ap-config will clear ap config and reboot the AP, Are you sure you want continue? (y/n) y

All AP configuration including AP's static IP configuration has been cleared.
And, that will clear the configuration in NVRAM.  You can verify that with the “show lwapp client config command.  The first is the before, and the second is the after (after it has rebooted).


LWAP1#show lwapp client config
... (lines removed for ease of explanation)
name                    LWAP1
mwarName                WLC1
mwarName                WLC2
And, then, after the command is run
AP001d.a1ec.11cc#show lwapp client config
AP001d.a1ec.11cc#
 
 
So, now, you have a clean config.  Or, mostly clean.  You can use various methods to have the AP discover a WLC (DNS, DHCP, broadcast), but you still cannot statically define information from the CLI.  Go ahead.  Try lwapp ap controller ip address x.x.x.x or clear lwapp private-config.  You will get the infamous ERROR!!! Command is disabled. error message.

AP001d.a1ec.11cc#lwapp ap controller ip address 10.10.111.20
ERROR!!! Command is disabled.
 
 
But, wasn’t the configuration cleared???  Mostly yes.  However, the image file used to boot the AP after the config was cleared is the full LWAPP image that it was last using.  It uses the information in the flash:env_vars file in order to boot using that information.


AP001d.a1ec.11cc#more flash:env_vars
BOOT=flash:/c1130-k9w8-mx.124-10b.JDD/c1130-k9w8-mx.124-10b.JDD
DEFAULT_ROUTER=10.0.0.1
ENABLE_BREAK=no
IP_ADDR=10.0.0.1
MANUAL_BOOT=no
NETMASK=255.255.255.224
RELOAD_REASON=9
TERMLINES=0
 
 
The other pieces should look familiar as well, to those who have used the local TFTP method of converting from LWAPP to IOS.  Because of using a full LWAPP image, the AP knows that at one point it was joined to a WLC.  If it was joined to a WLC, then the lwapp commands shouldn’t be used.
So, how do we get around this?  The simplest way I have found is to treat the AP as if you were going to do a local TFTP upgrade, but without the TFTP server.  If you power down the AP and then hold the Mode button until it turns red (about 20 seconds), the AP will boot up.  If you look at the console, you will see the following:


button pressed for 20 seconds
process_config_recovery: set IP address and config to default 10.0.0.1
process_config_recovery: image recovery
image_recovery: Download default IOS tar image tftp://255.255.255.255/c1130-k9w7-tar.default
 
 
Looks like a TFTP upgrade.  Then, when the TFTP transfer times out, the AP gives an error message %Error opening long_file_name.  After this, it shows:


Loading "flash:/c1130-rcvk9w8-mx/c1130-rcvk9w8-mx"...###############################[...]

File "flash:/c1130-rcvk9w8-mx/c1130-rcvk9w8-mx" uncompressed and installed, entry point: 0x3000
executing...
Ah, the recovery image!  After the AP boots, the flash:env_vars file no longer has that BOOT line.
AP001d.a1ec.11cc#more flash:env_vars
DEFAULT_ROUTER=10.0.0.1
ENABLE_BREAK=no
IP_ADDR=10.0.0.1
MANUAL_BOOT=no
NETMASK=255.255.255.224
RELOAD_REASON=9
TERMLINES=0
 
 
Now, when we try the lwapp commands, they will be accepted.  This is because it is the recovery image, not the full image.  Let’s see what happens:
AP001d.a1ec.11cc#lwapp ap controller ip address 10.10.111.20
AP001d.a1ec.11cc#
examining image...
Loading file /c1130...
!
extracting info (292 bytes)
Image info:
    Version Suffix: k9w8-.124-10b.JDD
    Image Name: c1130-k9w8-mx.124-10b.JDD
    Version Directory: c1130-k9w8-mx.124-10b.JDD
    Ios Image Size: 3645952
    Total Image Size: 3645952
    Image Feature: WIRELESS LAN|LWAPP
    Image Family: C1130
    Wireless Switch Management Version: 4.2.207.0
Extracting files...
c1130-k9w8-mx.124-10b.JDD/ (directory) 0 (bytes)
extracting c1130-k9w8-mx.124-10b.JDD/c1130-k9w8-mx.124-10b.JDD (3374566 bytes)
*Mar  1 0!0:08:23.897: %LWAPP-5-CHANGED: LWAPP changed state to JOIN
*Dec  2 23:38:41.161: %LWAPP-5-CHANGED: LWAPP changed state to IMAGE!!
 
 
So, the lwapp command was accepted, and now we can statically define the WLC for it to discover. While you probably won’t have to do this on the lab (though, who knows!) hopefully it can be useful in the field or in your home lab.

No comments:

Post a Comment