12-29-2011 06:43 AM - edited 11-18-2020 02:56 AM
How to Automatically Save, backup or upload Configuration Script on WLC.
Is there a way to save the WLC configuration as a .txt file or a copy start to tftp command like in a switch or router in order to later paste or load it to another or the same WLC?
Add a new backup WLC in network (only the name and IP address will be different) in order to avoid going step by step through it's configuration.
Or
In order to restore default settings in current WLC and then loading a config file.
Starting from 5.2 or later, when loading the config file via FTP or TFTP, you can actually open it with a text editor and it should show as a list of commands:
Saving Configurations
Controllers contain two kinds of memory: volatile RAM and NVRAM. At any time, you can save the configuration changes from active volatile RAM to non-volatile RAM (NVRAM) using one of these commands:
•save config—Saves the configuration from volatile RAM to NVRAM without resetting the controller.
•reset system—Prompts you to confirm that you want to save configuration changes before the controller reboots.
•logout—Prompts you to confirm that you want to save configuration changes before you log out.
In this way you can make changes with the text editor and load it back to the WLC. Alternatively, you could also copy the whole config as a text,
go in the WLC's config mode (with the "config" command) and at the prompt "config>" simply copy the whole config text file.
Is there a method to save configs automatically and periodically to TFTP/FTP server or anywhere WITHOUT using WCS?
There is a way to do this using expect scripts. You can use cron to call the shell script that calls the commands expect file.
commands expect script for backing up configs. Change the script upload variables for your environment
#!/usr/bin/expect
set router [ lindex $argv 0]
set username [ lindex $argv 1]
set password [ lindex $argv 2]
spawn ssh $router
#log_user 0
set timeout 10
expect "(yes/no)?" {
send "yes\r"; exp_continue }
expect "User:"
send -- "$username\r"
expect "assword:"
send -- "$password\r"
expect "Controller"
send -- "transfer upload datatype config\r"
expect "Controller"
send -- "transfer upload mode tftp\r"
expect "Controller"
send -- "transfer upload serverip <your tftp or ftp server ip>\r"
expect "Controller"
send -- "transfer upload start\r"
# some wlc config commands require yes/no verification
expect "(y/N)"
send -- "y\r"
expect "Controller"
send "logout\r"
expect "(y/N)"
send -- "n\r"
expect eof
You could also use a PHP script as per below (You will have to fill in the username/password from the WLC web admin if your using FTP first).
<?php
$TargetIP='IP Address of WLC';
$TargetUser='Username';
$TargetPass='Password';
$MySSH=ssh2_connect($TargetIP);
ssh2_auth_none($MySSH,$TargetUser);
$MyShell=ssh2_shell($MySSH);
sleep(1);
fwrite($MyShell,$TargetUser."\r");
sleep(1);
fwrite($MyShell,$TargetPass."\r");
sleep(1);
while($buffer=fgets($MyShell,4096))
{
print($buffer);
};
fwrite($MyShell,'transfer upload datatype config'."\r");
sleep(1);
fwrite($MyShell,'transfer upload mode ftp'."\r");
sleep(1);
fwrite($MyShell,'transfer upload serverip IP_of_ftp_server'."\r");
sleep(1);
while($buffer=fgets($MyShell,4096))
{
print($buffer);
};
fwrite($MyShell,'transfer upload start'."\r");
sleep(1);
fwrite($MyShell,'y'."\r");
sleep(1);
$WaitFlag=True;
while($WaitFlag)
{
sleep(1);
$buffer=fgets($MyShell,4096);
flush();
if (!is_null($buffer))
{
if(strpos($buffer,'file transfer failed')!== False) $WaitFlag=False;
if(strpos($buffer,'operation completed successfully')!== False) $WaitFlag=False;
print($buffer.PHP_EOL);
};
};
fclose($MyShell);
?>
Then setup a MS automatic task from a Windows server and run php + script argument.
Dear Sir,
How to take config backup of WLC trough Web http or https..
good topic, Guys,
does anyone have already a script for batch change of parameters on many WLCs:
- need to read management ip addresses of WLCs from a file
- initiate a script to connect one-by-one to each WLC and, lets say, change Radius accounting and save changes on the WLC
- log all actions happened on each WLC to see if any change failed or applied incorrectly
that would be a good job!
script for batch change of accounting Radius server is done on Perl with help of "Net::SSH::Expect" module, all who needs it, welcome.
Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: