#File Name: startup.exp #!/usr/bin/expect -- set timeout 3 set prompt "(%|#|\\$) $" ; catch {set prompt $env(EXPECT_PROMPT) } puts "Telnet into Router 7" set tpid1 [ spawn telnet 10.10.10.7 ] expect "Password" send "cisco\r" expect ">" send "en \r" expect "Password" send "cisco\r" expect "#" send "conf t\r" expect "#" send "ip route 1.1.1.0 255.255.255.0 120.10.10.150\r" expect "#" send "ip route 150.10.10.0 255.255.255.0 120.10.10.150\r" expect "#" exec kill -9 $tpid1 wait puts "Telnet into Home Agent Access Point" set tpid2 [ spawn telnet 120.10.10.100 ] expect "]:" send "=\r" expect "]:" send "s \r" expect "]:" send "ex\r" expect "#" send "ra\r" expect "]:" send "home\r" expect "]:" send "apply\r" #expect "]:" exec kill -9 $tpid2 wait puts "Telnet into Foreign Agent Access Point" set tpid3 [ spawn telnet 130.10.10.100 ] expect "]:" send "=\r" expect "]:" send "S \r" expect "]:" send "ex\r" expect "#" send "ra\r" expect "]:" send "fore\r" expect "]:" send "apply\r" # expect "]:" exec kill -9 $tpid3 wait