-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathbird.conf
194 lines (158 loc) · 3.75 KB
/
bird.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
table peering;
table kernelcopy;
protocol device {
scan time 10;
}
# host configuration
#####################
include "bird_host.conf";
# constants
############
define OWNAS = 201173;
define OWNMAGIC = 42;
define KERNEL_TABLE = ipt_freifunk;
# filter helpers
#################
function is_default() { return net ~ [ 0.0.0.0/0 ]; }
function is_freifunk() { return net ~ [ 10.0.0.0/8+ ]; }
function is_dn42() { return net ~ [ 172.22.0.0/15+ ]; }
function is_chaosvpn() { return net ~ [ 172.31.0.0/16+ ]; }
function is_self_net() { return net ~ [ 10.130.0.0/16+ ]; }
function is_self_mesh() { return net ~ [ 10.130.0.0/20+ ]; }
function is_self_private() { return net ~ [ 10.130.64.0/18+ ]; }
# static routes
################
protocol static static_mesh {
table peering;
route 10.130.0.0/16 reject;
};
protocol static local_mesh {
route 10.130.0.0/20 via "freifunk-hl";
};
# 464XLAT
##########
protocol static static_464xlat {
route 10.130.64.0/18 via "nat64";
}
# Mesh-internal routing
########################
protocol rip rip_mesh {
interface "freifunk-hl";
import where is_self_private() && (rip_metric < 16);
export where !((OWNMAGIC, 1) ~ bgp_community);
};
# OSPF between gateways
########################
protocol ospf ospf_mesh {
preference 90;
export where !((OWNMAGIC, 1) ~ bgp_community);
import where is_default() || is_self_net();
area 0 {
interface "freifunk-hl" {
authentication cryptographic;
include "password.conf";
type nonbroadcast;
neighbors {
10.130.0.252 eligible; # huextertor
10.130.0.253 eligible; # holstentor
10.130.0.254 eligible; # muehlentor
10.130.0.255 eligible; # burgtor
};
};
};
};
# Kernel routing tables
########################
protocol kernel {
scan time 20;
device routes;
import none;
export filter {
if is_dn42() then { krt_prefsrc = OWNIP; accept ; }
if is_freifunk() then { krt_prefsrc = OWNIP; accept ; }
reject;
};
};
protocol kernel {
table kernelcopy;
kernel table KERNEL_TABLE;
scan time 20;
device routes;
import none;
export filter {
if is_default() then accept;
if is_dn42() then { krt_prefsrc = OWNIP; accept ; }
if is_freifunk() then { krt_prefsrc = OWNIP; accept ; }
reject;
};
}
# plumbing
###########
protocol pipe {
peer table kernelcopy;
import none;
export all;
}
protocol pipe {
peer table peering;
import all;
export none;
}
# static routes
################
protocol static unreachable_default {
preference 0;
route 0.0.0.0/0 reject;
}
# public IPv4
##############
protocol static local_ip4 {
table peering;
route OWNIP_PUBLIC/32 reject;
};
# Mesh-internal BGP between all gateways
#########################################
template bgp bgp_ibgp {
table peering;
local as OWNAS;
direct;
gateway direct;
import all;
export filter { bgp_community.add((OWNMAGIC, 1));
if is_default() then reject;
if source = RTS_BGP then accept;
reject;
};
}
# InterCity VPN peerings
#########################
template bgp bgp_icvpn {
table peering;
local as OWNAS;
import where (is_freifunk() || is_dn42() || is_chaosvpn()) && !is_self_net();
export where (is_freifunk() || is_dn42());
};
# ffrheinland ipv4
###################
template bgp bgp_ffrhein {
table peering;
local as 201173;
import all;
export where net ~ [185.66.193.32/29+];
next hop self;
}
# DN42 peerings
################
template bgp bgp_dn42 {
table peering;
local as OWNAS;
import where is_dn42() || is_chaosvpn();
export all;
};
# Include local configuration
# '?' instead of 'f' avoids failures when these
# files do not exist
################################################
include "bird_local.con?";
include "bird_ibgp.con?";
include "bird_icvpn.con?";