Catalyst 6500 , running TCL scripts to configure sub-interfaces

From DocWiki

Jump to: navigation, search



Document for creating multiple sub-interfaces on Catalyst 6500 using TCL script.


For creating 100 sub-interfaces using Vlan 2 to 101 with ip address to


Cat6k#tclsh ( for going to the tcl shell )

Cat6k(tcl)#set ip 2 ( here we are creating a variable for ip address and setting its value to 1 )

Cat6k(tcl)#set vlan 2 ( This variable is created for configuring vlan to be used by sub-interfaces )

Cat6k(tcl)#for { set i 1 } { $i <= 100 } { incr i } { ( starting a for loop from i = 1 to 100, inc i increments the value of i after each step )

Cat6k(tcl)#ios_config “int g1/4.$i” “encapsulation dot1q $vlan” “ ip address 192.0.$ip.1” “no shut” ( Here we are giving the commands we want to run on config mode on the switch , each command in seperate double colons)

Cat6k(tcl)#incr ip; ( incrementing the value of ip )

Cat6k(tcl)#incr vlan; ( incrementing the value of vlan )

Cat6k(tcl)#} ( closing the loop )

Related show Commands

This section provides information you can use to confirm your configuration is working properly.

show ip interface brief to verify the sub-interfaces and there ip addresses.

Rating: 4.0/5 (2 votes cast)

Personal tools