Zyxel Switch Automatic Configuration Backup for Ubuntu






Introduction
The main purpose of this article is to provide users with standard procedures to backup running configuration of switches through SSH session by Python3 and configure a Crontab for a periodical backup.
Unsupported switch models
The following switch models do not support this application:
- GS1200 Series
- GS1900 Series
- XGS1210-12
- XGS1250-12
- NSW100
- NSW200
Prerequisite
1. Install Python 3.7 or later versions.
2. Install Crontab
3. Install Python modules. (netmiko and datetime)
Type “pip3 install netmiko && pip3 install datetime” in terminal (root privilege).
4. Download Backup file.
5. Copy netmiko-4.0.0a4-py3.10.egg to usr/lib/python3/dist-packages
Confirm netmiko-4.0.0a4-py3.10.egg is in dist-packages folder
NOTE: This test is done by using Ubuntu 20.04
Application
Explanation of File
After completing all prerequisite items, check if the downloaded Backup file has the following files:
- AutoBackupConfig_Windows.py
- device_list.txt
1) What to do with “AutoBackupConfig_Windows.py”?
It’s a script that helps you to backup each of your switch running configuration one at a time.
Before running the script, you must manually enter the file path on line 48.
For example, if I need to store the running configurations on a folder called “SW_config” under /usr/user/Desktop/, I should enter “/usr/user/Desktop/SW_config” as my file path.
2) What to do with “device_list.txt”?
This file stores your switch IP, account, and password. Your script will reference this file when performing configuration backup.
For instance, you should see the following two switch’s IP and credential:
- 192.168.1.1,admin,1234,
- 192.168.1.2,admin,1234,
Script reads these information line by line.
Each variable should be separated with a comma (,) and do not leave any space.
Crontab
1. Open terminal
2. Type “ crontab –e”
3. Put the command to Crontab
Cd /home/(user)/Desktop/Zyxel_switch_automation_backup/ && python3 AutoBackupConfig_Ubuntu.py
Well done! You just finish all the steps.
You can adjust your task to next minute to see if it is working properly.
Note
1. This program can only perform one SSH session at a time.
2. User is able to perform hourly backup with “Create Task”.
3. The original script is available in the public domain. Feel free to modify or edit the script for your convenience.
Categories
- 8K All Categories
- 1.6K Nebula
- 60 Nebula Ideas
- 55 Nebula Status and Incidents
- 4.5K Security
- 224 Security Ideas
- 974 Switch
- 47 Switch Ideas
- 868 WirelessLAN
- 20 WLAN Ideas
- 5K Consumer Product
- 140 Service & License
- 268 News and Release
- 53 Security Advisories
- 12 Education Center
- 573 FAQ
- 273 Nebula FAQ
- 132 Security FAQ
- 73 Switch FAQ
- 72 WirelessLAN FAQ
- 7 Consumer Product FAQ
- Documents
- 34 Nebula Monthly Express
- 72 About Community
- 44 Security Highlight