Advertisement
Guest User

Untitled

a guest
Sep 21st, 2016
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.88 KB | None | 0 0
  1. #!/usr/bin/expect
  2.  
  3. set timeout 5
  4. set hostname [lindex $argv 0]
  5.  
  6. set username "username"
  7. set password "password"
  8. set directory /tmp/expect_logs
  9.  
  10. set command [lindex $argv 1]
  11.  
  12. log_file $directory/$hostname.putlog
  13.  
  14. spawn telnet $hostname
  15.  
  16. expect "Username:" {
  17. send "$username\n"
  18. expect "Password:"
  19. send "$password\n"
  20.  
  21. expect "#"
  22. send "conf t\n"
  23. expect "(config)#"
  24. send "interface tun2222\n"
  25. expect "(config-if)#"
  26. send "$command\n"
  27. expect "(config-if)#"
  28. send "no ip redirects\n"
  29. expect "(config-if)#"
  30. send "ip mtu 1330\n"
  31. expect "(config-if)#"
  32. send "ip nhrp map multicast 55.1.7.559\n"
  33. expect "(config-if)#"
  34. send "ip nhrp map 55.1.7.559 65.65.65.65\n"
  35. expect "(config-if)#"
  36. send "ip nhrp network-id 13579\n"
  37. expect "(config-if)#"
  38. send "ip nhrp nhs 55.1.7.559\n"
  39. expect "(config-if)#"
  40. send "ip nhrp cache non-authoritative\n"
  41. expect "(config-if)#"
  42. send "ip tcp adjust-mss 1300\n"
  43. expect "(config-if)#"
  44. send "no ip split-horizon\n"
  45. expect "(config-if)#"
  46. send "tunnel source Dialer1\n"
  47. expect "(config-if)#"
  48. send "tunnel mode gre multipoint\n"
  49. expect "(config-if)#"
  50. send "exit\n"
  51. expect "(config)#"
  52. send "ip access-list standard DL_IN_IPSEC\n"
  53. expect "(config-std-nacl)#"
  54. send "permit 172.17.0.0 0.0.255.255\n"
  55. expect "(config-std-nacl)#"
  56. send "permit 10.0.0.0 0.0.0.255\n"
  57. expect "(config-std-nacl)#"
  58. send "deny any\n"
  59. expect "(config-std-nacl)#"
  60. send "ip access-list standard DL_OUT_GRE\n"
  61. expect "(config-std-nacl)#"
  62. send "permit 172.17.0.0 0.0.255.255\n"
  63. expect "(config-std-nacl)#"
  64. send "permit 55.0.0.0 0.0.0.255\n"
  65. expect "(config-std-nacl)#"
  66. send "deny any\n"
  67. expect "(config-std-nacl)#"
  68. send "ip access-list standard DL_OUT_IPSEC\n"
  69. expect "(config-std-nacl)#"
  70. send "permit 172.17.0.0 0.0.255.255\n"
  71. expect "(config-std-nacl)#"
  72. send "permit 44.0.0.0 0.0.0.255\n"
  73. expect "(config-std-nacl)#"
  74. send "deny any\n"
  75. expect "(config-std-nacl)#"
  76. send "exit\n"
  77. expect "(config)#"
  78. send "router rip\n"
  79. expect "(config-router)#"
  80. send "version 2\n"
  81. expect "(config-router)#"
  82. send "passive-interface Vlan1\n"
  83. expect "(config-router)#"
  84. send "network 55.0.0.0\n"
  85. expect "(config-router)#"
  86. send "network 44.0.0.0\n"
  87. expect "(config-router)#"
  88. send "network 172.17.0.0\n"
  89. expect "(config-router)#"
  90. send "neighbor 55.1.7.559\n"
  91. expect "(config-router)#"
  92. send "distribute-list DL_OUT_GRE out Tunnel2222\n"
  93. expect "(config-router)#"
  94. send "distribute-list DL_OUT_IPSEC out Tunnel1111\n"
  95. expect "(config-router)#"
  96. send "distribute-list DL_IN_IPSEC in Tunnel1111\n"
  97. expect "(config-router)#"
  98. send "no auto-summary\n"
  99. expect "(config-router)#"
  100. send "exit\n"
  101. expect "(config)#"
  102. send "exit\n"
  103. expect "#"
  104. send "wr mem\n"
  105. expect "#"
  106. send "exit\n"
  107. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement