GNS3 Talks: Python for Network Engineers with GNS3 (Part 2) - Configure VLANs on 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://youtu.be/IhroIrV9_7w 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. In this video we program a Cisco IOSvL2 switch with VLANs by using Python on an Ubuntu Docker container.
Script used in this video is available on GitHub here: https://github.com/davidbombal/pythonvideos/blob/master/pythonS1script1.py
This is one of multiple videos teaching you network programmability using Python and GNS3. might take on the learning programming or any other technology is to just do it,try it make mistakes, pick yourself up and try again.
Don't try and do it perfectly on the first run. Create some code and then iterate or improve and refine your code as you go along. GNS3 makes this process very easy.
In the previous video, I configured the router using a Python script. This is what our Python script looks like. We programmatically configured the loopback addresses and OSPF on the Cisco IOS of the router.
Now let's configure the switch.
The router was given this IP address through DHCP. What I'll do is configure the switch manually on the SVI so IP address question mark. We have to specify the IP address here,so we'll use 72. So hostname switch1.
We need to configure login details, so I'll set an enable password a Cisco,I'll set up a username of David, With a password of Cisco and on the vty lines, I'm going to use the command log in local and transport input all.
So let's manually test that telnet works a telnet to the IP address of the switch. Log in with our username of David, password of cisco enable put password in, we can login, so we've proven that telnet works on the switch.
On the switch at the moment, show VLAN brief shows us that only the default VLANs are configured.
Now previously we configured this Python script.
What I'm going to do now is copy this Python script to another script called pythonS1script1
As I said in the previous video, we are not trying to do everything perfectly here we are trying to get started and we'll iterate and improve as we go along.
So let's use an nano to edit that script. In this case the IP address of the switch is 192.168.122.72
We'll be prompted for our username and our password.
We're going to telnet to that host. we are looking for a username and password prompt.
So let's confirm that that's what we're going to see. We are prompted for a username so that's correct. We're prompted for a password so that's correct.
So the script will correctly look for and then enter those values. We're going to send the enable command to the switch ente ... https://www.youtube.com/watch?v=_XGtQRUWasQ
51464218 Bytes