Tcl script on Cisco 1941 router to change IP address on interface and to remove/add IP route statements
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2019 11:50 AM - edited 03-05-2019 11:12 AM
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
- Labels:
-
Other Routers

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2019 02:41 PM
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"
