-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy paths2.sh
25 lines (21 loc) · 757 Bytes
/
s2.sh
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
#!/bin/sh
apt-get update
apt-get install -y traceroute
echo "1 std" >> /etc/iproute2/rt_tables
echo "2 anycast" >> /etc/iproute2/rt_tables
tee /etc/network/if-up.d/anycast <<EOF
#!/bin/sh
ip route add 10.20.3.0/24 dev eth1 src 10.20.3.100 table std
ip route add default via 10.20.3.13 dev eth1 table std
ip rule add from 10.20.3.100/32 table std
ip rule add to 10.20.3.100/32 table std
ip route add 10.30.1.0/24 dev eth2 src 10.30.1.3 table anycast
ip route add default via 10.30.1.2 dev eth2 table anycast
ip rule add from 10.30.1.3/32 table anycast
ip rule add to 10.30.1.3/32 table anycast
EOF
chmod +x /etc/network/if-up.d/anycast
/etc/network/if-up.d/anycast
ping -c 1 10.30.1.2
apt-get install -y nginx
echo "s2" > /usr/share/nginx/html/index.html