cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
481
Views
1
Helpful
5
Replies

Schedule backup WLC to SCP

hs08
VIP
VIP

Hello,

Can we make schedule to backup cisco WLC to the SCP server?

5 Replies 5

Leo Laohoo
Hall of Fame
Hall of Fame

Depends if the WLC is AireOS or IOS-XE.

I use WLC 2504 with OS version 8.5.182 (i believe this is AireOS), right?

Yes, that's AireOS. 

You will need to script it.

are you know the script?

Script logic would be
SSH to WLC

Issue backup commands

WLC1) >transfer upload mode tftp
(WLC1) >transfer upload datatype config
(WLC1) >transfer upload filename 10_xx_yy_1_160802_2200.cfg
(WLC1) >transfer upload path /
(WLC1) >transfer upload serverip 192.168.10.1
(WLC1) >transfer upload start

Using ChatGPT asking to create a python script to backup an AireOS WLC to a SCP server returns this (please validate before runing against a prod WLC

 

import paramiko
from scp import SCPClient

# WLC and SCP server details
wlc_ip = 'WLC_IP_ADDRESS' # Replace with your WLC IP
wlc_username = 'WLC_USERNAME' # Replace with WLC username
wlc_password = 'WLC_PASSWORD' # Replace with WLC password

scp_server_ip = '192.1.1.1'
scp_username = 'SCP_USERNAME' # Replace with SCP server username
scp_password = 'SCP_PASSWORD' # Replace with SCP server password
remote_backup_dir = '/backup_directory/' # SCP server path where file will be stored

# WLC config file path
wlc_config_file = '/path/to/wlc/config/file'

# SSH and SCP functions
def create_ssh_client(host, username, password):
client = paramiko.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.connect(host, username=username, password=password)
return client

def backup_wlc_config_to_scp():
try:
# Connect to WLC via SSH
ssh_client = create_ssh_client(wlc_ip, wlc_username, wlc_password)
print("Connected to WLC")

# Command to generate backup or get WLC configuration if needed
# stdin, stdout, stderr = ssh_client.exec_command('show running-config')
# output = stdout.read().decode()

# Connect to SCP server
with SCPClient(ssh_client.get_transport()) as scp:
print("Connected to SCP server")
# Transfer WLC config file to SCP server
scp.put(wlc_config_file, remote_backup_dir)
print(f"Backup transferred to {scp_server_ip}:{remote_backup_dir}")

except Exception as e:
print(f"Error: {str(e)}")
finally:
ssh_client.close()

if __name__ == "__main__":
backup_wlc_config_to_scp()

*****Help out other by using the rating system and marking answered questions as "Answered"*****
*** Please rate helpful posts ***
Review Cisco Networking for a $25 gift card