This repository is deprecated; please follow the main search page or use the ‘Related code repos’ widget on the right side of the current page.

cisco_backup_jump_server

Python script using Netmiko to take a cisco config snapshot , via an intermediate jump server

alt text

Tested in python3.7

This script is useful for network engineers when there is a linux jump server ( jumpbox ) between the user

and the end cisco device, and eg corporate security controls prevent a direct ssh session.

Installation

Create a virtual environment eg called 'backup'

  • python -m virtualenv backup

Activate the virtual environment

  • backup\Scripts\activate.bat

Install Netmiko

  • pip install netmiko

Verify with pip list

Usage

python backup_cisco.py

This script will call devices.txt and take a 'show run' config snapshot of each

cisco device in the list, writing each device config to a separate .txt file

It presumes there maybe different usernames/ passwords for the jump server vs the end device,

so it will initially prompt the user for all credentials.

It also presumes the user/pass is constant for all the devices in the txt file

Create a file devices.txt , a device ip address on every new line. see the example file in the repo to understand
the format required.Edit this list with your device's ip addresses

Have ready the creds for:

  • Jump Server IP:
  • Jump Server Username:
  • End Cisco Device Username:
  • End Cisco Exec Password:

getpass will hide the password screen input

Testing

You can use the Cisco Modelling Labs Enterprise sandbox

There is an example lab topology preloaded called "Multi Platform Network". This includes a devbox, some cisco devices and a few linux hosts

Known Issues

The RSA key in the jumpbox must match the RSA key in the end cisco device.

If this is not the case, then you may get a keygen error on trying to connect. The solution is to clear the key from the 'ssh/known_hosts' file

An example command would be ssh-keygen -R 10.10.10.1 where 10.10.10.1 is the ip of the end cisco device

Authors & Maintainers

Please contact me for any modifications on this script.

License

This project is licensed to you under the terms of the MIT icense

View code on GitHub
  • Owner

  • Contributors

    +1Github contributor
  • Categories

  • Programming Languages

    Python
  • License

    MIT License

Code Exchange Community

Get help, share code, and collaborate with other developers in the Code Exchange community.View Community
Disclaimer:
Cisco provides Code Exchange for convenience and informational purposes only, with no support of any kind. This page contains information and links from third-party websites that are governed by their own separate terms. Reference to a project or contributor on this page does not imply any affiliation with or endorsement by Cisco.