-
Notifications
You must be signed in to change notification settings - Fork 0
/
routereflector1.sh
80 lines (69 loc) · 1.41 KB
/
routereflector1.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
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
68
69
70
71
72
73
74
75
76
77
78
79
80
# Setup Route Reflector 1
bash <<EOF2
sed -i 's/localhost/reflector1/g' /etc/hostname
sed -i 's/localhost/reflector1/g' /etc/hosts
hostname reflector1
apk add bird --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing
rc-update add bird
cat >> /etc/network/interfaces << EOF
auto eth1
iface eth1 inet static
address 10.40.243.4
netmask 255.255.255.128
EOF
/etc/init.d/networking restart
cat > /etc/bird.conf << EOF1
# Configure logging
log syslog { debug, trace, info, remote, warning, error, auth, fatal, bug };
log stderr all;
# Override router ID
router id 10.40.243.4;
# Define local AS variable
define haproxyas = 64705;
# Define spirit AS variable
define spiritas = 65516;
# Sync bird routing table with kernel
protocol kernel {
ipv4 {
export all;
};
}
protocol device {
scan time 2;
}
# Include directly connected networks
protocol direct {
interface "eth1";
}
protocol bgp haproxy11 {
local as haproxyas;
neighbor 10.40.243.9 as haproxyas;
ipv4 {
import all;
export all;
};
rr client;
}
protocol bgp haproxy21 {
local as haproxyas;
neighbor 10.40.243.10 as haproxyas;
ipv4 {
import all;
export all;
};
rr client;
}
protocol bgp router1 {
ipv4 {
import none;
export all;
};
local as haproxyas;
source address 10.40.243.4;
neighbor 10.40.243.3 as spiritas;
# Override the usual restriction of LOCAL_PREF on eBGP sessions
allow bgp_local_pref;
}
EOF1
exit
EOF2