Python script that connects over SSH with Netmiko to Alcatel-Lucent Enterprise OS6450 switches (all models, whatever the number of ports) and automatically backs up their configuration to a NAS.
- Features
- Requirements
- Installation
- Configuration
- Usage
- Scheduling with cron
- Roadmap
- Project structure
- License
- Author
- SSH connection to ALE OS6450 switches using Netmiko
- Configuration retrieval with the
show configuration snapshotcommand - One backup folder per switch to keep everything tidy
- Backups stored on a NAS over SMB
- Retention policy: only the 5 most recent backups per switch are kept, older ones are deleted automatically
- Logging and error handling: if a switch does not answer, the script carries on with the next ones
- Linux (tested on Ubuntu)
- Python 3.8+
- SSH access enabled on the switches
- An accessible SMB share (NAS)
# Clone the repository
git clone https://github.com/thomaswithlinux/backup-config-ale-switch.git
cd backup-config-ale-switch
# Install the dependencies
pip install -r requirements.txt- Mount the NAS SMB share on the Linux machine:
sudo apt install cifs-utils
sudo mkdir -p /mnt/backups
sudo mount -t cifs //NAS_IP/backups /mnt/backups -o username=USER- Fill in the list of switches in the script (name, IP address, credentials):
switches = [
{"name": "SW-CORE", "host": "192.168.X.X"},
{"name": "SW-01", "host": "192.168.X.X"},
]Important: never publish your real credentials or real IP addresses on GitHub. Use environment variables or a configuration file added to
.gitignore.
python3 backup_switches.pyExample of the resulting tree:
/mnt/backups/
├── SW-CORE/
│ ├── SW-CORE_2026-09-28_02-00.txt
│ └── ...
└── SW-01/
├── SW-01_2026-09-28_02-00.txt
└── ...
To run the backup every day at 2 a.m.:
crontab -e0 2 * * * /usr/bin/python3 /path/to/backup_switches.py
- Separate configuration file (YAML or
.env) - E-mail notification on failure
- Configuration comparison (change detection)
backup-config-ale-switch/
├── docs/
│ └── banner.svg # README banner
├── backup-ale-os6450.py # the backup script
├── requirements.txt # Python dependencies
├── LICENSE # MIT license
└── README.md # this file
Released under the MIT license — see the LICENSE file.
Thomas Letard — @thomaswithlinux · Portfolio Apprentice TSSR · Linux, networking & automation