Catalyst 6500 , running TCL scripts to configure sub-interfaces

From DocWiki

Revision as of 09:40, 4 June 2010 by Vlodha (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Contents

Introduction

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

Design

For creating 100 sub-interfaces using Vlan 2 to 101 with ip address 192.0.2.1 to 192.0.102.1/24


Configuration

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 255.255.255.0” “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: 5.0/5 (1 vote cast)

Personal tools