puts "Telnet into Home Agent to change static routes"
set tpid4 [ spawn telnet 120.10.10.8 ]
expect "Password"
send "cisco\r"
expect ">"
send "en \r"
expect "Password"
send "cisco\r"
expect "#"
send "conf t\r"
expect "#"
send "no ip route 1.1.1.0 255.255.255.0 120.10.10.150\r"
expect "#"
send "no ip route 150.10.10.0 255.255.255.0 120.10.10.150\r"
expect "#"
send "ip route 1.1.1.0 255.255.255.0 11.11.11.2\r"
expect "#"
send "ip route 150.10.10.0 255.255.255.0 11.11.11.2\r"
expect "#"
## Variable var1 is declared to check if tunnel comes up.
set var1 0
while {$var1 != 1} {
send "sh ip route \r"
expect -ex "Tunnel0"
{
puts "Tunnel is established\n"
puts "Setting var1 to value 1"
set var1 1
}
exp_continue
}
## while end here
set pingvar 0
while {$pingvar != 1} {
send "ping 120.10.10.150\r"
expect -ex "100 percent"
set pingvar 1
}
exp_continue
exec kill -9 $tpid4
##################### Go back to Home Agent Again #############
               (
geocities.com/shezy22/code)                   (
geocities.com/shezy22)