cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2962
Views
4
Helpful
2
Replies

Script for make change in various device.

martin.germano
Level 1
Level 1

 

i want to make changes in more than 30 cisco devices.

For example:

  • conf t
  • logging host 10.10.2.4

So, there is a TCL script to make ssh in my devices and make this changes? Instead get into the device one by one.

Thanks a lot

PS: I know that Cisco Prime works, but now i can't buy it.

2 Accepted Solutions

Accepted Solutions

Aaron Drydale
Level 1
Level 1

I don't believe there is a way via a TCL script to handle entering a password after the SSH command is entered.

SecureCRT is a paid program which allows for a decent amount of scripting. You can have a script read a list of devices from a text file (for flexibility), prompt the user to enter their username/password at the beginning of the script, and it can go through each device and execute the commands in the script. It can be done in about 20-30 lines of code (VBS, Python, or Javascript) but SecureCRT has a couple of it's own commands you'd need use (their documentation is good but a little long).

There may be some alternative free programs with scripting built in. I know TeraTerm has scripting in some form but I'm unsure how flexible or easy it is to use. I looked at it briefly at one point and wasn't too impressed but you can't beat the price.

View solution in original post

lrian
Level 1
Level 1

You can use rancid to run the same commands on multiple devices:
cat <<_EOF_ > /tmp/x
conf term
logging host 10.10.2.4
end
_EOF_
clogin -x /tmp/x devName1 devName2 ... devNameN

get rancid from http://www.shrubbery.net/rancid/
For windows you'll also need cygwin: http://www.cygwin.com/


> Aaron Drydale
> I don't believe there is a way via a TCL script to handle entering a password after the SSH command is entered.

include the ssh command in the tcl/expect script

Regards,
Lee

View solution in original post

2 Replies 2

Aaron Drydale
Level 1
Level 1

I don't believe there is a way via a TCL script to handle entering a password after the SSH command is entered.

SecureCRT is a paid program which allows for a decent amount of scripting. You can have a script read a list of devices from a text file (for flexibility), prompt the user to enter their username/password at the beginning of the script, and it can go through each device and execute the commands in the script. It can be done in about 20-30 lines of code (VBS, Python, or Javascript) but SecureCRT has a couple of it's own commands you'd need use (their documentation is good but a little long).

There may be some alternative free programs with scripting built in. I know TeraTerm has scripting in some form but I'm unsure how flexible or easy it is to use. I looked at it briefly at one point and wasn't too impressed but you can't beat the price.

lrian
Level 1
Level 1

You can use rancid to run the same commands on multiple devices:
cat <<_EOF_ > /tmp/x
conf term
logging host 10.10.2.4
end
_EOF_
clogin -x /tmp/x devName1 devName2 ... devNameN

get rancid from http://www.shrubbery.net/rancid/
For windows you'll also need cygwin: http://www.cygwin.com/


> Aaron Drydale
> I don't believe there is a way via a TCL script to handle entering a password after the SSH command is entered.

include the ssh command in the tcl/expect script

Regards,
Lee

Review Cisco Networking for a $25 gift card