Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/expect
- set timeout 5
- set hostname [lindex $argv 0]
- set username "username"
- set password "password"
- set directory /tmp/expect_logs
- set command [lindex $argv 1]
- log_file $directory/$hostname.putlog
- spawn telnet $hostname
- expect "Username:" {
- send "$username\n"
- expect "Password:"
- send "$password\n"
- expect "#"
- send "conf t\n"
- expect "(config)#"
- send "interface tun2222\n"
- expect "(config-if)#"
- send "$command\n"
- expect "(config-if)#"
- send "no ip redirects\n"
- expect "(config-if)#"
- send "ip mtu 1330\n"
- expect "(config-if)#"
- send "ip nhrp map multicast 55.1.7.559\n"
- expect "(config-if)#"
- send "ip nhrp map 55.1.7.559 65.65.65.65\n"
- expect "(config-if)#"
- send "ip nhrp network-id 13579\n"
- expect "(config-if)#"
- send "ip nhrp nhs 55.1.7.559\n"
- expect "(config-if)#"
- send "ip nhrp cache non-authoritative\n"
- expect "(config-if)#"
- send "ip tcp adjust-mss 1300\n"
- expect "(config-if)#"
- send "no ip split-horizon\n"
- expect "(config-if)#"
- send "tunnel source Dialer1\n"
- expect "(config-if)#"
- send "tunnel mode gre multipoint\n"
- expect "(config-if)#"
- send "exit\n"
- expect "(config)#"
- send "ip access-list standard DL_IN_IPSEC\n"
- expect "(config-std-nacl)#"
- send "permit 172.17.0.0 0.0.255.255\n"
- expect "(config-std-nacl)#"
- send "permit 10.0.0.0 0.0.0.255\n"
- expect "(config-std-nacl)#"
- send "deny any\n"
- expect "(config-std-nacl)#"
- send "ip access-list standard DL_OUT_GRE\n"
- expect "(config-std-nacl)#"
- send "permit 172.17.0.0 0.0.255.255\n"
- expect "(config-std-nacl)#"
- send "permit 55.0.0.0 0.0.0.255\n"
- expect "(config-std-nacl)#"
- send "deny any\n"
- expect "(config-std-nacl)#"
- send "ip access-list standard DL_OUT_IPSEC\n"
- expect "(config-std-nacl)#"
- send "permit 172.17.0.0 0.0.255.255\n"
- expect "(config-std-nacl)#"
- send "permit 44.0.0.0 0.0.0.255\n"
- expect "(config-std-nacl)#"
- send "deny any\n"
- expect "(config-std-nacl)#"
- send "exit\n"
- expect "(config)#"
- send "router rip\n"
- expect "(config-router)#"
- send "version 2\n"
- expect "(config-router)#"
- send "passive-interface Vlan1\n"
- expect "(config-router)#"
- send "network 55.0.0.0\n"
- expect "(config-router)#"
- send "network 44.0.0.0\n"
- expect "(config-router)#"
- send "network 172.17.0.0\n"
- expect "(config-router)#"
- send "neighbor 55.1.7.559\n"
- expect "(config-router)#"
- send "distribute-list DL_OUT_GRE out Tunnel2222\n"
- expect "(config-router)#"
- send "distribute-list DL_OUT_IPSEC out Tunnel1111\n"
- expect "(config-router)#"
- send "distribute-list DL_IN_IPSEC in Tunnel1111\n"
- expect "(config-router)#"
- send "no auto-summary\n"
- expect "(config-router)#"
- send "exit\n"
- expect "(config)#"
- send "exit\n"
- expect "#"
- send "wr mem\n"
- expect "#"
- send "exit\n"
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement