-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathswconf.exp
67 lines (63 loc) · 1.45 KB
/
swconf.exp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/expect -f
set timeout 20
set echo off
#Router/Switch username
set username manager
#Router/Switch password
set password #PASSWORD
#Router/Switch IP address
set ip [lindex $argv 0]
spawn ssh $username@$ip
send "yes\r"
expect "*?assword: "
send "$password\r"
expect "#"
send "configure\r"
expect "(config)#"
send "console idle-timeout 900\r"
expect "(config)#"
send "console idle-timeout serial-usb 900\r"
expect "(config)#"
send "logging #SYSLOGSRV\r"
expect "(config)#"
send "radius-server host #RadiusSRV key #KEY\r"
expect "(config)#"
send "timesync sntp\r"
expect "(config)#"
send "sntp unicast\r"
expect "(config)#"
send "sntp server priority 1 #NTP2\r"
expect "(config)#"
send "sntp server priority 2 #NTP2\r"
expect "(config)#"
send "time daylight-time-rule western-europe\r"
expect "(config)#"
send "time timezone 60\r"
expect "(config)#"
send "ip default-gateway #Gateway\r"
expect "(config)#"
send "no ip icmp echo broadcast-request\r"
expect "(config)#"
send "aaa authentication login privilege-mode\r"
expect "(config)#"
send "aaa authentication ssh login radius\r"
expect "(config)#"
send "activate provision disable\r"
expect "(config)#"
send "activate software-update disable\r"
expect "(config)#"
send "activate software-update disable\r"
expect "(config)#"
send "wr mem\r"
expect "(config)#"
send "exit\r"
expect "#"
send "exit\r"
expect ">"
send "exit\r"
expect "Do you want to log out (y/n)?"
send "y\r"
expect "Connection closed by"
expect eof
exit
exit