All Pages > howto > Routing daemons and dn42 > Bird 2
This guide is similar to the normal Bird guide in that it provides you with help setting up the BIRD routing daemon, with the difference that this page is dedicated to 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 an 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{16,32},.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 1000 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 1000 action block;
};
}
include "/etc/bird/peers/*";
Route Origin Authorization
The example config above relies on ROA configuration files in /etc/bird/roa_dn42{,_v6}.conf
. These should be automatically downloaded and updated every so often to prevent BGP highjacking, see the bird1 page for more details and links to the ROA files. Note: edit the links to replace roa_bird1 to say roa_bird2 if using the cron jobs listed on that page.
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 {
Setting up peers
Please note: This section assumes that you've already got a tunnel to your peering partner setup.
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>
syntax if a link local address is used (Which is recommended)