cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements
319
Views
0
Helpful
1
Replies
Highlighted

Tcl script on Cisco 1941 router to change IP address on interface and to remove/add IP route statements

Can someone please share with me an example of a tcl script to change an IP address on an interface and well as add/remove IP route statements? 

 

Thank you,

Jacob

Everyone's tags (6)
1 REPLY 1
VIP Mentor

Re: Tcl script on Cisco 1941 router to change IP address on interface and to remove/add IP route statements

Hello,

 

here is a very simple TCL script to add an IP address (192.168.1.1/24) to an interface (GigabitEthernet0/0) and remove a staic route (ip route 0.0.0.0 0.0.0.0 null 0) and add a static route (ip route 10.10.10.0 255.255.255.0 GigabitEthernet0/1). You can expand that script as you wish:

 

tclsh
set ip_address "192.168.1.1"
set mask "255.255.255.0"
ios_config "interface GigabitEthernet0/0" "ip address $ip_address $mask"
ios_config "no ip route 0.0.0.0 0.0.0.0 null 0"

ios_config "ip route 10.10.10.0 255.255.255.0 GigabitEthernet0/1"

CreatePlease to create content
Content for Community-Ad
July's Community Spotlight Awards