cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
3385
Views
10
Helpful
16
Replies
mohamedabdelalim
Beginner

how to run a command on multi routers

we have many routers and i want to run a command like 

clear crypto gdoi then yes 

on a multi routers at once any ideas ?

16 REPLIES 16
marce1000
VIP Advisor

 

 - Here's an example tool (probably there are numerous other solutions too) :

       http://anastarsha.com/use-parallel-ssh-to-run-commands-on-multiple-devices-at-the-same-time/

 M.

link didn't work i want a tool or an idea to make it 

Joseph W. Doherty
Hall of Fame Expert

At exactly the same time or just as quickly as you can cycle through all the routers?

Do you need resulting output of command?

Do you know ahead of time the command should be run, or is this we need to run it now?

Will command break any remote session connection?

not important in the same time but i have 200 routers i want to run the command clear crypto gdoi then yes becouse the cisco ip phone some time not registered and i have to run this command on every single router to register ip phone and it waste the time i want a tool or idea to run this command specifically on all routers faster 

Is there anything that can be "check" on the routers, themselves, that would show the need for this command?  If so, perhaps an EEM script could self monitor and apply the command as needed.

If not, might be able to write an external program that access each router and applies the command.  Execution could be sped in the controlling program can access multiple routers concurrently and/or doesn't need to wait on the results of the remotely executed command.  (NB: in the past, I've written both PERL and Python scripts to make changes to hundreds of routers.)

Lastly, there might be some management application that could perform a role similar to what I just described, but if so, I'm not current on what's in the marketplace.

thanks for help and for your description i will search for a tool again 

I have a ssh client python script posted on git hub.   Access the script here:  https://github.com/dafrey243/ssh_client

 

 how to run this script sorry it's the first time for Me in the programing field just give me the headlines and I will search for the way to do it .. thanks in advance.

Run the script by executing: python sshclient.py. 

Here is an example with config_file.txt has contents:

enable

cisco

show clock       

 

[dafrey@CrashCart functions]$ python sshclient.py 

192.168.0.1

C1111>term len 0

C1111>enable

Password: 

 

C1111#

show clock

13:39:07.796 UTC Mon Aug 30 2021

C1111#

C1111#

192.168.0.2

C3750X-G>term len 0

C3750X-G>enable

Password: 

 

C3750X-G#

show clock

*13:17:38.212 UTC Fri Jun 4 1993

C3750X-G#

<truncate>

where to locate the script? i locate it in a new folder on the desktop as the attached screenshot showing

 

Untitled.jpg

...

any answer please for my previous replay ??

This is from a linux system to run a script in python 2.7 interactive mode.   I am not sure if this is the same for windows.

 

[dafrey@CrashCart ~]$ cd /biz/python/bin/functions/

[dafrey@CrashCart functions]$ ls -l sshclient.py 

-rwxrwxrwx 1 root root 1233 Aug 30 09:34 sshclient.py

[dafrey@CrashCart functions]$ python

Python 2.7.5 (default, Nov 16 2020, 22:23:17) 

[GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux2

Type "help", "copyright", "credits" or "license" for more information.

>>> execfile('sshclient.py')

192.168.0.1

/usr/lib/python2.7/site-packages/paramiko/rsakey.py:119: CryptographyDeprecationWarning: signer and verifier have been deprecated. Please use sign and verify instead.

  algorithm=hashes.SHA1(),

 

C1111>term len 0

C1111>enable

Password: 

 

C1111#

hello Eng Daniel 

i need the secrept with telnet not ssh 

thanks in advance