-
Notifications
You must be signed in to change notification settings - Fork 0
/
routereflector2.sh
79 lines (70 loc) · 1.46 KB
/
routereflector2.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
# Setup Route Reflector 2
bash <<EOF2
sed -i 's/localhost/reflector2/g' /etc/hostname
sed -i 's/localhost/reflector2/g' /etc/hosts
hostname reflector2
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.5
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.5;
# 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 {
ipv4;
interface "eth1";
}
protocol bgp haproxy21 {
local as haproxyas;
neighbor 10.40.243.11 as haproxyas;
ipv4 {
import all;
export all;
};
rr client;
}
protocol bgp haproxy22 {
local as haproxyas;
neighbor 10.40.243.12 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.5;
neighbor 10.40.243.2 as spiritas;
# Override the usual restriction of LOCAL_PREF on eBGP sessions
allow bgp_local_pref;
}
EOF1
exit
EOF2