Zyxel Switch Automatic Configuration Backup for Windows
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 Windows Task scheduler 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 Python modules. (netmiko and datetime)
Type “pip3 install netmiko && pip3 install datetime” in command prompt (admin privilege).
3. Download Backup file.
4. Copy netmiko-4.0.0a4-py3.10.egg file to
C:\yourpath\AppData\Roaming\Local\Programs\Python\Python310\Lib\site-packages.
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
- AutoBackupConfig.bat
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.
3) What to do with “AutoBackupConfig.bat”?
In order to make your Task scheduler working, creating a .bat file is necessary.
We need to put “Path to Python3” (space) “Path to your script” in it.
To get the path of Python, type where python in command prompt.
Task scheduler
After configuring all the file settings, it is time to schedule your backup process.
1. Open Task Scheduler
2. Click “Create Basic Task” on the right menu.
3. Enter task name.
4. Choose trigger time (Daily, Weekly)
5. Select “Start a program” in Action page.
6. In Start a Program page, fill in the correct path to each field.
7. Click Finish.
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
- All Categories
- 414 Beta Program
- 2.3K Nebula
- 132 Nebula Ideas
- 91 Nebula Status and Incidents
- 5.4K Security
- 180 USG FLEX H Series
- 258 Security Ideas
- 1.4K Switch
- 71 Switch Ideas
- 1K Wireless
- 36 Wireless Ideas
- 6.2K Consumer Product
- 236 Service & License
- 372 News and Release
- 79 Security Advisories
- 24 Education Center
- 5 [Campaign] Zyxel Network Detective
- 2.9K FAQ
- 34 Documents
- 34 Nebula Monthly Express
- 80 About Community
- 69 Security Highlight