GNS3 Talks: Python for Network Engineers with GNS3 (Part 11) - Paramiko, SSH, Python and Cisco
David Bombal
Udemy: Get the course for $10 here: https://goo.gl/QYC988 GNS3 Academy: Get the course for $10 here: https://goo.gl/vnZJhg More free Python videos here: https://www.youtube.com/playlist?list=PLhfrWIlLOoKPn7T9FtvbOWX8GxgsFFNwn
Learn Python programming with GNS3. In this series of videos I will show you how you can quickly and easily program Cisco networks using Python.
================================ Script on GitHub:
https://github.com/davidbombal/pythonvideos/commit/fd4ba0c8c4506473ff7ec746f88fc30a98824069
================================ Install Paramiko:
apt-get update apt-get install python -y apt-get install build-essential libssl-dev libffi-dev -y apt-get install python-pip -y apt-get installpython-dev # You may need to install this as well pip install cryptography pip install paramiko
================================ Al's GNS3 community entry:
https://gns3.com/discussions/docker-u...
Transcription:
Since I started recording the Python for Network Engineers videos, the number one request has been to demonstrate the use of SSH with Python and Cisco devices.
So as we can see here, there are a number of requests for SSH and Paramiko. This is one of multiple videos teaching you network programmability using Python and GNS3. Al, as an example has even gone further and created an entry on the GNS3 community showing you how to install Paramiko and Netmiko on the Ubuntu client that I've been demonstrating in these videos. So thanks Al for sharing.
I'm going to demonstrate how to install Paramiko using the steps that Al has shared on the GNS3 community.
In this topology I've got an Ubuntu docker container which I've configured to use DHCP. That's now booted and got an IP address from the NAT cloud.
So as an example the Ubuntu client can ping google.com. The Cisco switch in this topology has just booted but has no configuration on it.
So I'll demonstrate in a moment how to configure SSH on the switch and then we'll configure the Ubuntu client to use Paramiko and SSH to configure the switch. The module that I'm going to use for SSH is Paramiko.
This is a Python implementation of the SSH version 2 protocol which provides both client and server functionality. You can find out more information about Paramiko on paramiko.org or docs.paramiko.org.
I've written a script which I've linked below on github that imports Paramiko and uses SSH to connect to the Cisco switch and configure some options on the switch. We'll configure some loopback interfaces and then we'll run a loop to configure VLANs on the switch. So I'm hoping that this video and script help you configure network devices using SSH rather than just relying on telnet.
In this exam ... https://www.youtube.com/watch?v=xd1kI1eq5uw
62642846 Bytes