GNS3 Talks: Python for Network Engineers with GNS3 (Part 15) - Netmiko, SSH, Python Cisco switches
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/d6abbecb6702426cff9635ffe41fcfd2e7a5fb7d
Transcription:
This is one of the multiple videos showing you how to use Netmiko to configure a GNS3 topology. We’re applying the same configuration on all the switches and you might not want to do that. You might want to apply some code on some switches and different code on other switches.
So as an example, your access switches may require different configuration to your core switches. So what we could do is create a file for access switches and then create a file for call switches and what we could do is configure our access switches per the configuration in the access file and then configure the core switches with the configuration in the core file.
So let's copy that. I'll go back to GNS3. Let's create a new file called netmiko4 and paste the script in. Again it's not optimized fully but we'll get the job done…….
Now we're gonna copy iosv config to iosv access and call and then we'll edit iosv_l2 access and what we could do as an example is say only these ports will be configured on the access switches. So gigabit 0/0 - 1 will be configured as trunks. Other ports will configured as access ports and then on the core switches we could remove the access port configuration and only configure the relevant ports with the right configuration.
So now we can use the command python netmiko4 to configure, firstly the access switches and secondly the core switches.
So as you can see, Switch 5 is only configured on the relevant ports so is Switch 4. So is Switch 3 and now we have a different set of configuration for the core switches. Switch 2 is configured only with trunk ports and Switch 1 is only configured with trunk ports.
Now I must warn you using an in-band management network can cause problems when you’re making configuration changes like the configuration changes in our script. You may have issues with Spanning Tree 3 re-computing. You may have issues where changes that you make through the script can block IP connectivity to your devices and thus it makes more sense to have an out-of-band management network wherever possible or if you only have an in-band management network, be careful with Spanning Tree. Be careful with the changes that you are making because it could affect the script having SSH or telnet access to your switches.
If the Ubuntu devi ... https://www.youtube.com/watch?v=L_YfSU378yI
38676557 Bytes