Scripting can be very useful tool when networkers need to work on same activity repetitively. Some of the boring and time consuming activities are –
- Putting multiple interfaces in VLANs
- Configuring multiple entries of BGP neighborship
- Access list entries for same source or destination
And many more.
TCL Script for Multiple Loopbacks
So here comes in the TCL script which can complete some of repetitive and tedious jobs in seconds. Lets take an example where I want to configure 5 Loopbacks. The script will look something like this –
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} { puts [ ios_config “interface Loopback$number” “ip address $address 255.255.255.255” ] }
R1(tcl)#foreach {number address} {
+>(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)# } { puts [ ios_config “interface Loopback$number” “ip address $ address 255.255.255.255” ] }
The output of TCL script configuration is below –
Interface IP-Address OK? Method Status 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
Nice to see how TCL script can make tiring activities fun and time saver for techies.
Continue Reading:
BGP Neighborship Drops when NAT is Enabled
ABOUT THE AUTHOR
I am here to share my knowledge and experience in the field of networking with the goal being – “The more you share, the more you learn.”
I am a biotechnologist by qualification and a Network Enthusiast by interest. I developed interest in networking being in the company of a passionate Network Professional, my husband.
I am a strong believer of the fact that “learning is a constant process of discovering yourself.”
– Rashmi Bhardwaj (Author/Editor)