TCL SCRIPT FOR TENS OF LOOPBACKS IN SECONDS

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.


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 –

foreach {number address} {
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” ] }
Now lets test the configuration in lab –
R1#tclsh
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 [ io[ ios_config "interface Loopback$number” "ip address $ address 255.255.255.255” ]div>

The output of TCL script configuration is below –

R1#show ip int brief
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.

Please follow and like us:
error

Tags:

Related Posts

Add Comment

Social Media Auto Publish Powered By : XYZScripts.com
Select your currency
USD United States (US) dollar

Checkout : E-STORE for latest release "JNCIP-SEC & JNCIA-SEC Interview Q&A " Dismiss