GNS3 Talks: Python for Network Engineers with GNS3 (Part 15) - Netmiko, SSH, Python Cisco switches

David Bombal
David Bombal
16.3 هزار بار بازدید - 7 سال پیش - Udemy: Get the course for
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:    • Python Programming for Network Engineers   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 device can't SSH to the devices for whatever reason, you could end up with a half configured network. Be careful with in-band management. Now, you may want to optimize Spanning Tree and other options in this network show spanning tree, shows us that we have shared links between the switches. So as an example on gigabit 0/1 we might want to use the command spanning- tree link- type point-to-point to improve the way that Spanning Tree works that however should be configured on all devices in the network to improve Spanning Tree convergence. Again be careful with in=band management. So what I could do is say nano iosv_l2 access and what I'll do is paste that command under the trunk ports so that the trunk ports get configured as point to point Spanning Tree links which will improve convergence. On Switch 5 as an example shows spanning-tree notice all ports are shared ports we can see the root and alternate port but the ports are shared ports. So let's run python netmiko4 there the commands that are going to be applied. You can see as an example that Spanning Tree link type point-to-point will be used at the moment we still seeing the ports are shared ports configuration has been done. Notice the change point-to-point. So show run interface gigabit 0/0. Notice Spanning Tree point-to-point has been added to both the up links on the switch. But as an example, if we look at port 2/0 that is still configured as an access port the script is now configuring the core switches. Discounted link to course here: https://goo.gl/ntqu3G
7 سال پیش در تاریخ 1396/01/31 منتشر شده است.
16,381 بـار بازدید شده
... بیشتر