-
Notifications
You must be signed in to change notification settings - Fork 0
/
ifstated.conf
61 lines (54 loc) · 1.36 KB
/
ifstated.conf
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
# Adapted from https://github.com/vedetta-com/vedetta/blob/master/src/etc/ifstated.conf
init-state auto
# Monitor interface em1
egress_up = "em1.link.up"
# ping a well-known IPv4 address to check for connectivity
# any well-known IPv4 address can be used here
inet = '( "ping -q -c 1 -w 4 72.52.104.74 > /dev/null" every 60 )'
state auto {
if (! $egress_up) {
run "logger -t ifstated '(auto) egress down'"
set-state ifdown
}
if ($egress_up) {
run "logger -t ifstated '(auto) egress up'"
set-state ifup
}
}
state ifdown {
init {
run "sh /etc/netstart em1 && \
logger -t ifstated '(ifdown) egress reset'"
}
if ($egress_up) {
run "logger -t ifstated '(ifdown) egress up'"
set-state ifup
}
}
state ifup {
init {
run "logger -t ifstated '(ifup) entered ifup state'"
}
if ($inet) {
run "logger -t ifstated (ifup) IPv4 connection established."
set-state internet
}
if (! $inet && "sleep 10" every 10) {
run "logger -t ifstated '(ifup) IPv4 down'"
set-state ifdown
}
}
state internet {
init {
run "logger -t ifstated '(ifup) entered internet state'"
}
if ($inet) {
run "logger -t ifstated (internet) Running tunnelbroker update..."
run "sh /etc/tunnel_update.sh | logger -t tb.net"
run "logger -t ifstated (internet) Ran tunnelbroker update"
}
if (! $inet) {
run "logger -t ifstated (internet) Lost IPv4 connection"
set-state auto
}
}