----Original Message----- From: nobody@groupstudy.com [mailto:nobody@groupstudy.com] On Behalf Of Lee Donald Sent: Tuesday, September 20, 2005 4:28 AM To: Easyman; GroupStudy CCIE-Lab Subject: RE: About the TCL script Easyman, Here you go. tclsh foreach address { 183.1.58.5 183.1.78.8 183.1.17.7 183.1.123.2 183.1.2.2 204.12.1.254 183.1.0.5 183.1.46.6 123.123.123.2 192.10.1.254 } {ping $address repeat 2} Regards Lee. --- Here is a simplified one: tclsh foreach address { 1.1.1.1 2.1.2.2 } {ping $address} ---- Here is a version I created from pieces of other scripts. This one adds a little and may not be as hard to remember. **************************** tclsh proc ping_all {n} { foreach ip { 1.1.1.1 2.2.2.2 3.3.3.3 } { if {[regexp "(!!)" [exec "ping $ip"]]} { } else { puts "$ip *** FAILED ***" } } } exec **************************** ---- Some IOS seem to require the "puts" syntax as below. Without it, the pings actually happen (check debug icmp) but the result does not display. Give it a shot. foreach addr { 172.16.123.1 172.16.123.2 127.16.123.3 } {puts [exec "ping $addr"]} ---- This is the magic script I talked about in me CCIE email. I have recaived so many emails asking for the majic script that Bob Sinclair taught me. From those emails I know who didn't go to the Netmaster class because the Netmaster students know this already. I think the point of the script is to keep it simple. I did the TCL script and the rsh commands and it worked perfectly. You have make sure the host names are correct. For routers that can do tcl tclsh foreach router { 1.1.1.1 2.2.2.2 } {ping $router sou lo0 re 2 tim 1} For routers that cannot like the Cats From a router that can do tcl, and it is the router that you allowed RSH. tclsh foreach router { 1.1.1.1 2.2.2.2 } {rsh 1.1.1.1 ping $router} --- Enable the following commands on all routers: ip rcmd rsh-enable ip rcmd source-interface loop 0 ip rcmd remote-host R1 172.16.11.1 R1 enable ----- Subject: TCL Script I have written this script that frees you from copy past the sh ip alias output from each router to a separate notepad and extracting the ip addresses and then pasting into another script. It does it all for you - if you can remember it...! Just copy/past at each console set ip {} set add {} set output [sh ip alias] foreach line [split $output \r\n] { if {[regexp "Interface" $line]} { set ip [lindex $line 1] lappend add $ip puts $ip} } foreach ip $add {ping $ip} * If first time it eats words while pasting - try one more time. Output: ===== Rack02R3(tcl)#set output [sh ip alias] Address Type IP Address Port Interface 148.1.3.3 Interface 148.1.0.3 Interface 150.1.3.3 Interface 148.1.35.3 Interface 192.10.1.3 Rack02R3(tcl)#foreach line [split $output \r\n] { +>if {[regexp "Interface" $line]} { +>set ip [lindex $line 1] +>lappend add $ip +>puts $ip} +>} 148.1.3.3 148.1.0.3 150.1.3.3 148.1.35.3 192.10.1.3 Rack02R3(tcl)#foreach ip $add {ping $ip} Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 148.1.3.3, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 148.1.0.3, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 4/5/8 ms Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 150.1.3.3, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/4 ms Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 148.1.35.3, timeout is 2 seconds: ..... Success rate is 0 percent (0/5) Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 192.10.1.3, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 ms Nadeem ----