bahan ngeLAB :
- python2.7
- telnet
- komputer controller
- Switch / Router dengan module ESW
berikut topologi sederhananya :
kita akan membuat vlan di switch 1,2,3 . masing" 10 vlan. oke langsung kita mulai buat scriptnya, buat vlanmulti.py
import getpass
import sys
import telnetlib
user = raw_input("Enter your telnet username: ")
password = getpass.getpass()
for n in range (2,5):
HOST = "10.10.10." + str(n)
tn = telnetlib.Telnet(HOST)
tn.read_until("Username")
tn.write(user + "\n")
if password:
tn.read_until ("Password:")
tn.write(password + "\n")
tn.write("conf terminal\n")
for n in range (2,10):
tn.write("vlan " + str(n) + "\n")
tn.write("name Vlan_no" + str(n) + "\n")
tn.write("end\n")
tn.write("exit\n")
print tn.read_all()
0 komentar:
Posting Komentar