5b4ea6e766091c54a7a43f1c30e622aa6f97aec9
howto/Bird.md
... | ... | @@ -10,6 +10,8 @@ Compared to quagga, bird supports multiple routing, which is useful, if you also |
10 | 10 | * Replace `<PEER_AS>` the Autonomous System Number of your peer |
11 | 11 | * Replace `<PEER_NAME>` a self chosen name for your peer |
12 | 12 | |
13 | +### IPV4 |
|
14 | + |
|
13 | 15 | ``` |
14 | 16 | # /etc/bird/bird.conf |
15 | 17 | # Device status |
... | ... | @@ -146,6 +148,157 @@ protocol bgp <PEER_NAME> from dnpeers { |
146 | 148 | }; |
147 | 149 | ``` |
148 | 150 | |
151 | +### IPV6 |
|
152 | + |
|
153 | +``` |
|
154 | +#/etc/bird/bird6.conf |
|
155 | +protocol device { |
|
156 | + scan time 10; |
|
157 | +} |
|
158 | + |
|
159 | +# filter helpers |
|
160 | +################# |
|
161 | + |
|
162 | +include "/etc/bird/filter6.conf"; |
|
163 | + |
|
164 | +# local configuration |
|
165 | +###################### |
|
166 | + |
|
167 | +include "bird/local6.conf"; |
|
168 | + |
|
169 | +# Kernel routing tables |
|
170 | +######################## |
|
171 | + |
|
172 | +protocol kernel { |
|
173 | + scan time 20; |
|
174 | + device routes; |
|
175 | + import none; |
|
176 | + export filter { |
|
177 | + krt_prefsrc = OWNIP; |
|
178 | + accept; |
|
179 | + }; |
|
180 | +} |
|
181 | + |
|
182 | +# static routes |
|
183 | +################ |
|
184 | + |
|
185 | +protocol static { |
|
186 | + route <SUBNET> reject; |
|
187 | +} |
|
188 | + |
|
189 | +template bgp dnpeers { |
|
190 | + local as OWNAS; |
|
191 | + path metric 1; |
|
192 | + import keep filtered; |
|
193 | + import filter { |
|
194 | + if is_valid_network() && !is_self_net() then { |
|
195 | + accept; |
|
196 | + } |
|
197 | + reject; |
|
198 | + }; |
|
199 | + export filter { |
|
200 | + if is_valid_network() then { |
|
201 | + accept; |
|
202 | + } |
|
203 | + reject; |
|
204 | + }; |
|
205 | + route limit 10000; |
|
206 | +} |
|
207 | + |
|
208 | +include "/etc/bird/peers6/*"; |
|
209 | +``` |
|
210 | + |
|
211 | +``` |
|
212 | +# /etc/bird/local6.conf |
|
213 | +# should be a unique identifier, use same id as for ipv4 |
|
214 | +router id <GATEWAY_IP>; |
|
215 | + |
|
216 | +define OWNAS = <AS>; |
|
217 | +define OWNIP = <GATEWAY_IP>; |
|
218 | + |
|
219 | +function is_self_net() { |
|
220 | + return net ~ [<SUBNET>+]; |
|
221 | +} |
|
222 | +``` |
|
223 | + |
|
224 | +Generate the filter list from the monotone repository |
|
225 | + |
|
226 | +``` |
|
227 | +cd net.dn42.registry |
|
228 | +ruby utils/bgp-filter.rb < data/filter6.txt > /etc/bird/filter6.conf |
|
229 | +``` |
|
230 | + |
|
231 | +example filter list: |
|
232 | + |
|
233 | +``` |
|
234 | +function is_valid_network() { |
|
235 | + return net ~ [ |
|
236 | + fc00::/8{48,64}, # ULA (undefined) |
|
237 | + fd00::/8{48,64}, # ULA (defined) |
|
238 | + 2001:67c:20c1::/48{48,48}, # E-UTP IPv6 |
|
239 | + 2001:bf7::/32{32,128}, # Freifunk (Foerderverein Freie Netzwerke) IPv6 Range |
|
240 | + 2001:67c:20a1::/48{48,48}, # CCC Event Network |
|
241 | + 2001:0470:006c:01d5::/64{64,64}, # Registered IANA |
|
242 | + 2001:0470:006d:0655::/64{64,64}, |
|
243 | + 2001:0470:1f09:172d::/64{64,64}, |
|
244 | + 2001:0470:1f0b:0592::/64{64,64}, |
|
245 | + 2001:0470:1f0b:0bca::/64{64,64}, |
|
246 | + 2001:0470:1f0b:1af5::/64{64,64}, |
|
247 | + 2001:0470:1f10:0275::/64{64,64}, |
|
248 | + 2001:0470:1f12:0004::/64{64,64}, |
|
249 | + 2001:0470:5084::/48{48,64}, |
|
250 | + 2001:0470:51c6::/48{48,64}, |
|
251 | + 2001:0470:73d3::/48{48,64}, |
|
252 | + 2001:0470:7972::/48{48,64}, |
|
253 | + 2001:0470:9949::/48{48,64}, |
|
254 | + 2001:0470:99fc::/48{48,64}, |
|
255 | + 2001:0470:9af8::/48{48,64}, |
|
256 | + 2001:0470:9ce6::/55{55,64}, |
|
257 | + 2001:0470:9f43::/48{48,64}, |
|
258 | + 2001:0470:caab::/48{48,64}, |
|
259 | + 2001:0470:cd99::/48{48,64}, |
|
260 | + 2001:0470:d4df::/48{48,64}, |
|
261 | + 2001:0470:d889:0010::/64{64,64}, |
|
262 | + 2001:0470:e3f0:000a::/64{64,64}, |
|
263 | + 2001:067c:21ec::/48{48,64}, |
|
264 | + 2001:06f8:1019:0000::/64{64,64}, |
|
265 | + 2001:06f8:118b::/48{48,64}, |
|
266 | + 2001:06f8:1194::/48{48,64}, |
|
267 | + 2001:06f8:121a::/48{48,64}, |
|
268 | + 2001:06f8:1c1b::/48{48,64}, |
|
269 | + 2001:06f8:1d14::/48{48,64}, |
|
270 | + 2001:06f8:1d26::/48{48,64}, |
|
271 | + 2001:06f8:1d53::/48{48,64}, |
|
272 | + 2001:07f0:3003::/48{48,64}, |
|
273 | + 2001:08d8:0081:05c8::/63{63,64}, |
|
274 | + 2001:08d8:0081:05ca::/64{64,64}, |
|
275 | + 2001:15c0:1000:0100::/64{64,64}, |
|
276 | + 2001:1b60:1000:0001::/64{64,64}, |
|
277 | + 2001:41d0:0001:b6bb::/64{64,64}, |
|
278 | + 2001:41d0:0001:cd42::/64{64,64}, |
|
279 | + 2001:4dd0:fcff::/48{48,64}, |
|
280 | + 2001:4dd0:fdd3::/48{48,64}, |
|
281 | + 2001:4dd0:ff00:8710::/64{64,64}, |
|
282 | + 2604:8800:0179:4200::/56{56,64}, |
|
283 | + 2801:0000:80:8000::/50{50,64}, |
|
284 | + 2a00:1328:e101:0200::/56{56,64}, |
|
285 | + 2a00:1828:2000:0289::/64{64,64}, |
|
286 | + 2a00:1828:a013:d242::/64{64,64}, |
|
287 | + 2a00:5540:0387::/48{48,64}, |
|
288 | + 2a01:0198:022c::/48{48,64}, |
|
289 | + 2a01:0198:035a:fd13::/64{64,64}, |
|
290 | + 2a01:0198:0485::/48{48,64}, |
|
291 | + 2a01:04f8:0121:4fff::/64{64,64}, |
|
292 | + 2a01:04f8:0140:1ffd::/64{64,64}, |
|
293 | + 2a01:04f8:0d13:17c0::/64{64,64}, |
|
294 | + 2a02:0a00:e010:3c00::/56{56,64}, |
|
295 | + 2a02:0ee0:0002:0051::/64{64,64}, |
|
296 | + 2a03:2260::/30{30,64} |
|
297 | + ]; |
|
298 | +} |
|
299 | +``` |
|
300 | + |
|
301 | + |
|
149 | 302 | # Useful bird commmands |
150 | 303 | |
151 | 304 | bird can be remote controlled via the `birdc` command. Here is a list of useful bird commands: |
... | ... | @@ -169,6 +322,15 @@ bird> show route for 172.22.141.181 # show possible routes to internal.dn42 |
169 | 322 | 172.22.141.0/24 via 172.23.67.1 on tobee [tobee 07:20:30] * (100) [AS64737i] |
170 | 323 | via 172.23.64.1 on chelnok [chelnok 07:20:29] (100) [AS64737i] |
171 | 324 | via 172.23.136.65 on hax404 [hax404 07:20:26] (100) [AS64737i] |
325 | +bird> show route filtered |
|
326 | +172.23.245.1/32 via 172.23.64.1 on chelnok [chelnok 21:26:18] * (100) [AS76175i] |
|
327 | +172.22.247.128/32 via 172.23.64.1 on chelnok [chelnok 21:26:18] * (100) [AS76175i] |
|
328 | +172.22.227.1/32 via 172.23.64.1 on chelnok [chelnok 21:26:18] * (100) [AS76115i] |
|
329 | +172.23.196.75/32 via 172.23.64.1 on chelnok [chelnok 21:26:18] * (100) [AS76115i] |
|
330 | +172.22.41.241/32 via 172.23.64.1 on chelnok [chelnok 21:26:18] * (100) [AS76115i] |
|
331 | +172.22.249.4/30 via 172.23.64.1 on chelnok [chelnok 21:26:18] * (100) [AS4242420002i] |
|
332 | +172.22.255.133/32 via 172.23.64.1 on chelnok [chelnok 21:26:18] * (100) [AS64654i] |
|
333 | +... |
|
172 | 334 | ``` |
173 | 335 | |
174 | 336 | # External Links |