All Pages > howto > Routing daemons and dn42 > Bird 2
Installation notes
This page is applicable to bird versions 2.x
Arch Linux
The extra/bird
package in the arch repositories will usually have a relatively recent version and there is (usually) no need for a manual install over the usual # pacman -S bird
.
Bird2 Version <2.0.8 / Debian
Please note, that Bird2 versions before 2.0.8 don't support IPv6 extended nexthops for IPv4 destinations (https://bird.network.cz/pipermail/bird-users/2020-April/014412.html). Additionally Bird2 before 2.0.8 cannot automatically update filtered bgp routes when a used RPKI source changes.
Debian 11 Bullseye delivers Bird 2.0.7. But you can use the Debian Bullseye backport-repository which provides version 2.0.8 (see https://backports.debian.org/Instructions/ for adding backports repository and install packages from the repository).
Example configuration
Please note: This example configuration is made for use with IPv4 and IPv6 (Really, there is no excuse not to get started with IPv6 networking! :) )
The default config location in bird version 2.x is /etc/bird.conf
, but this may vary depending on how your distribution compiled bird.
When copying the configuration below onto your system, you will have to enter the following values in the file header:
- Replace
<OWNAS>
with your autonomous system number, e.g.4242421234
- Replace
<OWNIP>
with the ip that your router is going to have, this is usually the first non-zero ip in your subnet. (E.g. x.x.x.65 in an x.x.x.64/28 network) - Similarly, replace
<OWNIPv6>
with the first non-zero ip in your ipv6 subnet. - Then replace
<OWNNET>
with the IPv4 subnet that was assigned to you. - The same goes for
<OWNNETv6>
, but it takes an IPv6 subnet (Who'd have thought). - Keep in mind that you'll have to enter both networks in the OWNNET{,v6} and OWNNETSET{,v6}, the two variables are required due to set parsing difficulties with variables.
define OWNAS = <OWNAS>;
define OWNIP = <OWNIP>;
define OWNIPv6 = <OWNIPv6>;
define OWNNET = <OWNNET>;
define OWNNETv6 = <OWNNETv6>;
define OWNNETSET = [<OWNNET>+];
define OWNNETSETv6 = [<OWNNETv6>+];
id OWNIP;
device {
time 10;
}
/*
* Utility functions
*/
function ) {
net ~ OWNNETSET;
}
function ) {
net ~ OWNNETSETv6;
}
function ) {
net ~ [
.20.0.0/14{21,29},.20.0.0/24{28,32},.21.0.0/24{28,32},.22.0.0/24{28,32},.23.0.0/24{28,32},.31.0.0/16+,.100.0.0/14+,.127.0.0/16+,.0.0.0/8{15,24} ];
}
table dn42_roa;
table dn42_roa_v6;
static {
roa4 { table dn42_roa; };
include "/etc/bird/roa_dn42.conf";
};
static {
roa6 { table dn42_roa_v6; };
include "/etc/bird/roa_dn42_v6.conf";
};
function ) {
net ~ [
:/8{44,64} ];
}
kernel {
time 20;
ipv6 {
none;
filter {
if source = RTS_STATIC then reject;
OWNIPv6;
;
};
};
};
kernel {
time 20;
ipv4 {
none;
filter {
if source = RTS_STATIC then reject;
OWNIP;
;
};
};
}
static {
OWNNET reject;
ipv4 {
all;
none;
};
}
static {
OWNNETv6 reject;
ipv6 {
all;
none;
};
}
bgp dnpeers {
as OWNAS;
metric 1;
ipv4 {
filter {
if ) && ! ) then {
if ( dn42_roa, net, bgp_path.last) != ROA_VALID) then {
"[dn42] ROA check failed for ", net, " ASN ", bgp_path.last;
;
} else accept;
} else reject;
};
filter { if ) && source ~ [RTS_STATIC, RTS_BGP] then accept; else reject; };
limit 9000 action block;
};
ipv6 {
filter {
if ) && ! ) then {
if ( dn42_roa_v6, net, bgp_path.last) != ROA_VALID) then {
"[dn42] ROA check failed for ", net, " ASN ", bgp_path.last;
;
} else accept;
} else reject;
};
filter { if ) && source ~ [RTS_STATIC, RTS_BGP] then accept; else reject; };
limit 9000 action block;
};
}
include "/etc/bird/peers/*";
Setting up peers
Please note: This section assumes that you've already got a tunnel to your peering partner set up.
First, make sure the /etc/bird/peers directory exists:
# mkdir -p /etc/bird/peers
Then for each peer, create a configuration file similar to this one:
/etc/bird/peers/<NEIGHBOR_NAME>.conf
:
<NEIGHBOR_NAME> from dnpeers {
<NEIGHBOR_IP> as <NEIGHBOR_ASN>;
}
bgp <NEIGHBOR_NAME>_v6 from dnpeers {
<NEIGHBOR_IPv6>%<NEIGHBOR_INTERFACE> as <NEIGHBOR_ASN>;
}
bgp
Due to the special link local addresses of IPv6, an interface has to be specified using the %<if>
or the interface <if>;
syntax if a link local address is used (Which is recommended)
Note on multiprotocol BGP and extended next hops
This configuration example shows the required configuration without using multiprotocol BGP and extended next hops. These two options are helpful if one desires to optimize their peering by reducing the session count per peer to 1 (in the case of multiprotocol BGP) and remove the need to have IPv4 tunnel IP addresses (in the case of Extended next hops over IPv6)
BGP communities
Communities can be used to prioritize traffic based on different flags, in DN42 we are using communities to prioritize based on latency, bandwidth and encryption. It is really easy to get started with communities and we encourage all of you to get the basic configuration done and to mark your peerings with the correct flags for improved routing. More information can be found here.
Route Origin Authorization
Route Origin Authorizations should be used in BIRD to authenticate prefix announcements. These check the originating AS and validate that they are allowed to advertise a prefix.
RPKI / RTR for ROA
To use an RTR server for ROA information, replace this config in your bird2 configuration file:
roa4 { table dn42_roa; };
include "/etc/bird/roa_dn42.conf";
};
static {
roa6 { table dn42_roa_v6; };
include "/etc/bird/roa_dn42_v6.conf";
};
static {
... with this one (by changing address and port so it points to your RTR server)
roa4 { table dn42_roa; };
roa6 { table dn42_roa_v6; };
;
323;
600;
300;
7200;
}
rpki roa_dn42 {
To reflect changes in the ROA table without a manual reload, ADD "import table" switch for both channels in your DN42 BGP template:
ipv4 {
...existing configuration
table;
};
ipv6 {
...existing configuration
table;
};
}
bgp dnpeers {
ROA Tables
The ROA table can be generated from the registry directly or you can use the following pre-built ROA tables for BIRD:
ROA files generated by dn42regsrv are available from burble.dn42:
URL | IPv4/IPv6 | Description |
---|---|---|
https://dn42.burble.com/roa/dn42_roa_46.json | Both | JSON format for use with RPKI |
https://dn42.burble.com/roa/dn42_roa_bird1_46.conf | Both | Bird1 format |
https://dn42.burble.com/roa/dn42_roa_bird1_4.conf | IPv4 Only | Bird1 format |
https://dn42.burble.com/roa/dn42_roa_bird1_6.conf | IPv6 Only | Bird1 format |
https://dn42.burble.com/roa/dn42_roa_bird2_46.conf | Both | Bird2 format |
https://dn42.burble.com/roa/dn42_roa_bird2_4.conf | IPv4 Only | Bird2 format |
https://dn42.burble.com/roa/dn42_roa_bird2_6.conf | IPv6 Only | Bird2 format |
ROA files generated by roa_wizard are available from kioubit.dn42:
URL | IPv4/IPv6 | Description |
---|---|---|
https://kioubit-roa.dn42.dev/?type=v4 | IPv4 Only | Bird2 format |
https://kioubit-roa.dn42.dev/?type=v6 | IPv6 Only | Bird2 format |
https://kioubit-roa.dn42.dev/?type=json | Both | JSON format for use with RPKI |
Updating ROA tables
You can add cron entries to periodically update the tables:
*/15 * * * * curl -sfSLR {-o,-z}/etc/bird/roa_dn42.conf && birdc configure > /dev/null
*/15 * * * * curl -sfSLR {-o,-z}/etc/bird/roa_dn42_v6.conf && birdc configure > /dev/null
Or use a systemd timer: (check the commands before copy-pasting)
[Unit]
Update DN42 ROA
[Service]
oneshot
curl -sfSLR -o /etc/bird/roa_dn42.conf -z /etc/bird/roa_dn42.conf
curl -sfSLR -o /etc/bird/roa_dn42_v6.conf -z /etc/bird/roa_dn42_v6.conf
birdc configure
[Unit]
Update DN42 ROA periodically
[Timer]
2m
15m
1m
[Install]
timers.target
then enable and start the timer with systemctl enable --now dn42-roa.timer
.
More advanced script with error checking:
#!/bin/bash
roa4URL=""
roa6URL=""
roa4FILE="/etc/bird/roa/roa_dn42.conf"
roa6FILE="/etc/bird/roa/roa_dn42_v6.conf"
if ;then
fi
if ;then
fi
if ; then
else
fi
Use RPKI ROA in bird2
- Download stayrtr
https://github.com/bgp/stayrtr
- Run stayrtr.
- Run with docker
- Add this to your bird configure file (and remove other conflicting ROA setup, if present):
roa4 { table dn42_roa; };
roa6 { table dn42_roa_v6; };
"<your rpki server ip or domain>" port 8282;
keep 90;
keep 900;
keep 172800;
}
rpki rpki_dn42{