Scripting will be very great tool when networkers have to work on identical exercise repetitively. A few of the boring and time consuming actions are –
- Placing a number of interfaces in VLANs
- Configuring a number of entries of BGP neighborship
- Entry checklist entries for identical supply or vacation spot
And lots of extra.
TCL Script for A number of Loopbacks
So right here comes within the TCL script which might full a few of repetitive and tedious jobs in seconds. Lets take an instance the place I wish to configure 5 Loopbacks. The script will look one thing like this –
foreach {quantity handle} {
1 1.1.1.1
2 2.2.2.2
3 3.3.3.3
4 4.4.4.4
5 5.5.5.5} { places [ ios_config “interface Loopback$number” “ip address $address 255.255.255.255” ] }
Now lets check the configuration in lab –
R1#tclsh
R1(tcl)#foreach {quantity handle} {
+>(tcl)# 1 1.1.1.1
+>(tcl)# 2 2.2.2.2
+>(tcl)# 3 3.3.3.3
+>(tcl)# 4 4.4.4.4
+>(tcl)# 5 5.5.5.5
+>(tcl)#+>(tcl)# } { places [ ios_config “interface Loopback$number” “ip address $ address 255.255.255.255” ] }
The output of TCL script configuration is under –
R1#present ip int temporary
Interface IP-Handle OK? Technique Standing Protocol
FastEthernet0/0 unassigned YES unset administratively down down
FastEthernet0/1 unassigned YES unset administratively down down
Loopback1 1.1.1.1 YES unset up up
Loopback2 2.2.2.2 YES unset up up
Loopback3 3.3.3.3 YES unset up up
Loopback4 4.4.4.4 YES unset up up
Loopback5 5.5.5.5 YES unset up up
Good to see how TCL script could make tiring actions enjoyable and time saver for techies.
Proceed Studying:
Associated Posts