Questions?

Call us Monday through Friday, 6 AM - 6 PM (GMT -8) or Saturday and Sunday, 7 AM - 4 PM (GMT -8), or by email, and a CCIE Training Advisor will respond within 2 business hours.

 
Testimonials

Guys....for soooooo long i have waited for this opportunity,...to tell you guys...I DID IT!! Hmmm.....what a journey. It all started in 2002 in a friend's car..i saw a CCNA book at the back of his car.... and after going through it for a while, i fell inlove with Cisco. I made CCNA in 2003 after i...

[+] Expand

Chika Acha
CCIE #18904

Read More Testimonials

 
Why Choose Internetwork Expert For ccie Training?
It's simple. You are trying to obtain your CCIE number and Internetwork Expert is all about CCIE numbers. Internetwork Expert has the fastest growing list of candidates that have used our products and services to pass the Cisco CCIE Lab Exam. So when you are looking for the true industry leader in CCIE preparation, our numbers speak for themselves. More...
 

CCIE Lab Preparation Resources

Using TCLSH and RSH to Ensure Full Reachability

Introduction:

The following document describes how to use the TCL shell and RSH to ensure full reachability of all IP addresses in a lab. The TCL shell (TCLSH) is found in IOS feature sets that support VoIP. The 2500 and 4000 series routers are not supported along with the Cataylst 3550 switches. RSH is available on IOS based router and switch platforms.

Overview:

TCL (Tool Control Language) is a scripting language used extensiviely by Cisco Systems to facilited the testing of various router and switch platform. More information on TCL can be found at http://www.tcl.tk.

RSH (Remote SHell) is used to execute commands on a remote device. RSH was originally developed for use in a UNIX enviroment to ease the management of multiple machines. RSH is extremely insecure and in turn is not commonly used anymore. RSH is found in the Cisco IOS and in nearly all Linux/UNIX distributions.

Hardware Used:

  • 2 Cisco Routers connected by Ethernet
  • IOS version 12.2T

Configurations:

R1:

version 12.2
!
hostname Rack1R1
!
no ip domain lookup
!
interface Loopback0
 ip address 150.1.1.1 255.255.255.0
!
interface Ethernet0/0
 ip address 10.1.1.1 255.255.255.0
!
router rip
 version 2
 network 10.0.0.0
 network 150.1.0.0
 no auto-summary
!
line con 0
line aux 0
line vty 0 4
 password cisco
 login

!
end

R2:
version 12.2
!
hostname Rack1R2
!
ip rcmd rsh-enable
ip rcmd remote-host Rack1R1 10.1.1.1 Rack1R1 enable
!
no ip domain lookup
!
interface Loopback0
 ip address 150.1.2.2 255.255.255.0
!
interface Ethernet0/0
 ip address 10.1.1.2 255.255.255.0
!
router rip
 version 2
 network 10.0.0.0
 network 150.1.0.0
 no auto-summary
!
line con 0
line aux 0
line vty 0 4
 password cisco
 login
!
!
end

TCL Script:
proc ping_all {ip} {
if {[regexp "(!!)" [exec "ping $ip"]]} {

set counter 0
exec "term len 0"
set hostname [lindex [exec rsh $ip "sho run | include hostname"] 1]
set int [exec rsh $ip "show ip int brief"]
set length [llength $int]

while {$counter<=$length} {
 set tmp [lindex $int $counter]

if {[regexp "(^\[0-9]+\.\[0-9]+\.\[0-9]+\.\[0-9]+)" $tmp ]} {
  puts "\n"
  puts "**********************************"
  puts "* Ping $hostname [lindex $int [expr $counter - 1]]"
  puts "**********************************"
  exec "ping $tmp"
  }
 incr counter
 }
 } else {
  puts "\n\n"
  puts "IP address $ip is not reachable\n"
  set route [exec "show ip route $ip"]
  puts "Output from the show ip route command\n"
  puts "[exec "show ip route $ip"]"
 }
}

Script Breakdown :
The script reads in the IP address of the device you want to
test reachability to. The script then tests to ensure that is
can reach that particular IP address by trying to ping the IP
address. If the ping is unsucessfull an error message is
displayed like below:

Rack1R1#ping_all 150.1.4.4


IP address 150.1.4.4 is not reachable

Output from the show ip route command

% Subnet not in table

Rack1R1#

If the ping is sucessful the script RSH's to the remote device
and discovers it's hostname along with all the IP addresses that
are assigned to the interfaces of the remote device. Next the
script attempts to ping the IP addresses of the remote router from
the local router.

Implementation:

Rack1R1#tclsh
Rack1R1(tcl)#
Rack1R1(tcl)#proc ping_all {ip} {
+>
+> if {[regexp "(!!)" [exec "ping $ip"]]} {
+>
+>   set counter 0
+>   exec "term len 0"
+>   set hostname [lindex [exec rsh $ip "sho run | include hostname"] 1]
+>   set int [exec rsh $ip "show ip int brief"]
+>   set length [llength $int]
+>
+>   while {$counter<=$length} {
+>     set tmp [lindex $int $counter]
+>
+>     if {[regexp "(^\[0-9]+\.\[0-9]+\.\[0-9]+\.\[0-9]+)" $tmp ]} {
+>       puts "\n\n"
+>       puts "**********************************"
+>       puts "*  Ping $hostname [lindex $int [expr $counter - 1]]"
+>       puts "**********************************"
+>       exec "ping $tmp"
+>     }
+>     incr counter
+>   }
+> } else {
+>          puts "\n"
+>          puts "IP address $ip is not reachable\n"
+>          set route [exec "show ip route $ip"]
+>          puts "Output from the show ip route command\n"
+>          puts "[exec "show ip route $ip"]"
+> }
+>}

Rack1R1(tcl)#ping_all 150.1.2.2



**********************************
*  Ping Rack1R2 Ethernet0/0
**********************************

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.1.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 ms


**********************************
*  Ping Rack1R2 Loopback0
**********************************

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 150.1.2.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 ms
Rack1R1(tcl)#

© 2004 Internetwork Expert, Inc.