cancel
Showing results forĀ 
Search instead forĀ 
Did you mean:Ā 

one script for multiple routers

one script for multiple routers

Michael_Smalls
New Contributor
I am interested in a script that uses only a mac address in the format XX:XX:XX:XX:XX:XX OR XXXX.XXXX.XXXX to execute 5 static commands across multiple routers.

Essentially i want to be able to copy/paste a mac address for a program such as SecureCrt/Putty. After i paste the mac address i would like the following commands to execute on after the other

1. sh cab mod 'COPIED MAC ADDRESS'
2. sh cab mod 'COPIED MAC ADDRESS' conn
3. sh cab mod 'COPIED MAC ADDRESS' flap
4. sh cab mod 'COPIED MAC ADDRESS' cpe
5. sh ip arp

Is this possible. below is what is was able to come up with so far using script recorder in Secure Crt, upon that i don't know what else to do.

Problem 1
I would have to know what router the mac address is on to run the script. (i would like script to run all routers i have connected at one time) Note: if i have to do each router at a time that is ok if aforementioned is not possible and/or scripting to complex

Problem 2

Because mac address' are different and i have to manually input them i would mean that commands 2-5 would not execute if using script below.

I am sure that there is a way the edit script where after MAC ADDRESS is copied into command_1 , that same MAC ADDRESS will be place into subsequent commands 2-4. But i just don't know the programming language.

Can some please assist per below

#$language = "VBScript"#$interface = "1.0"

crt.Screen.Synchronous = True

' This automatically generated script may need to be
' edited in order to work correctly.

Sub Main
crt.Screen.Send "sh cab mod FF:FF:FF:FF:FF:FF" & chr(13)
crt.Screen.WaitForString "Switch>"
crt.Screen.Send "sh cab mod FF:FF:FF:FF:FF:FF conn" & chr(13)
crt.Screen.WaitForString "Switch>"
crt.Screen.Send "sh cab mod FF:FF:FF:FF:FF:FF flap" & chr(13)
crt.Screen.WaitForString "Switch>"
crt.Screen.Send "sh cab mod FF:FF:FF:FF:FF:FF cpe" & chr(13)
crt.Screen.WaitForString "Switch>"
crt.Screen.Send "sh ip arp " & chr(13)
End Sub
12 REPLIES 12

Michael_Smalls
New Contributor
thanks much

Jeremy_Gibbs
Contributor
When I get back from the gym, I will write you a script.

Sounds cool

Well, Cygwin is a terminal emulator. So you can even replace Putty with it. Because it's a linux command line ļ™‚. When I ssh to a switch, I do ssh -l myusername 10.0.0.1

The terminal asks me for my password and I type it in. Boom, im ssh'ed into a switch. You can also telnet into a switch just as easy. If for ssh you don't want to use the -l switch, you can do ssh myusername@10.0.0.1. Anyway, cygwin is very easy to use for what I am suggesting.
GTM-P2G8KFN