cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2443
Views
5
Helpful
5
Replies

Boot and config router cisco automatic using TCL script

maitrongturng
Level 1
Level 1

Hello everyone, 
I am a beginner. I search for the course, how can we automatically boot config and cisco router using TCL script? 
I do not know if it is possible. 
If yes, how is it? 
If not, what solution can it replace? 
Well thank you everyone!

5 Replies 5

Joe Clarke
Cisco Employee
Cisco Employee

On the network management thread, you mentioned that you want to fully boot a router (including the IOS) over the network.  This isn't fully possible, at least not on all platforms.  You need to at least have some image on the router.  Then, assuming the router does not have a valid startup configuration, it will boot, request an IP via DHCP, get a TFTP boot server, and fetch an initial config file.  One you can do that, you can push a config that contains an EEM applet to the router.  This EEM script can then download a more complex Tcl script.  Once you have Tcl on there, the sky is the limit.  You can do all sorts of things including downloading new IOS and configuring any parameters you want. 

 

As I pointed out previously, this is exactly what I did at CiscoLive this year in San Francisco.  I did it with switches, but the same procedure will work with routers.  I included all of my code and documented some of the process at https://supportforums.cisco.com/blog/12218591/automating-cisco-live-2014-san-francisco .

Hello Joseph, 
Thank you for your reply. 
In your opinion, what is to say that we need EEM in the config file and download this EEM TCL scripts? But after downloading tcl script, how do you Execute? Waiting until the end of AutoInstall and execute command "tclsh script.tcl"? I await your reply with impatience. 
Have a nice day.

The EEM Tcl policy that gets downloaded can execute on a timer.  If you look at http://www.marcuscom.com/viewvc/viewvc.cgi/marcuscom/switch-ztp/trunk/eem/tm_sw_autoconf.tcl?revision=19678&view=markup you will see that this policy, once registered, will start based on a one second timer.

Hello,

For the script, you must configure the policy in the tcl file startup-config; is that it? 

So if the file no longer resides on nvram, the policy would be executed?

Thanks very much.

Have a nice day

I don't understand the question.  The Tcl script will be copied to the device, then registered in the running config.  In my solution, the startup-config is replaced with the actual config for the device.  This replacement startup-config does NOT contain the line to register the EEM Tcl policy.  The result is that while the Tcl script may still reside on flash, it is not registered, and thus does not run when the device reboots.