Python – Script4: Configure Vlans on Multiple Switches

Picture1 1 Python - Script4: Configure Vlans on Multiple Switches

import getpassimport sysimport telnetlib user = raw_input(“Enter your telnet username: “)password = getpass.getpass() for j in range (21,25):              print “Telnet to host 192.168.10.” + str(j)              HOST = “192.168.10.” + str(j)              tn = telnetlib.Telnet(HOST)               …

Keep Reading

Python – Script3: Configure Vlans via Loop on Switch

Picture1 1 Python - Script3: Configure Vlans via Loop on Switch

import getpassimport sysimport telnetlib HOST = raw_input(“Enter Device IP: “)user = raw_input(“Enter your telnet username:”)password = getpass.getpass() tn = telnetlib.Telnet(HOST) tn.read_until(“Username: “)tn.write(user + “\n”)if password:    tn.read_until(“Password: “)    tn.write(password + “\n”) tn.write(“enable\n”)tn.write(“cisco\n”)tn.write(“conf t\n”) for n in range(2,10):    …

Keep Reading

Python – Script2: Configure Vlans on Switch

Picture1 1 Python - Script2: Configure Vlans on Switch

import getpassimport sysimport telnetlib HOST = raw_input(“Enter Device IP: “)user = raw_input(“Enter your telnet username:”)password = getpass.getpass() tn = telnetlib.Telnet(HOST) tn.read_until(“Username: “)tn.write(user + “\n”)if password:    tn.read_until(“Password: “)    tn.write(password + “\n”) tn.write(“enable\n”)tn.write(“cisco\n”)tn.write(“conf t\n”)tn.write(“vlan 2\n”)tn.write(“name Python_Vlan_2\n”)tn.write(“exit\n”)tn.write(“vlan 3\n”)tn.write(“name …

Keep Reading