Template: BIRD Route Server Configuration

The following is an example configuration file for a BIRD route server (http://bird.network.cz/) courtesy of Mike Barnard from the Uganda Internet eXchange Point (http://www.uixp.co.ug). This configuration includes support for selective policies by way of BGP Communities. For more information, including an example of a participant/peer client-side route configuration file, see here: http://uixp.co.ug/route-servers

### Begin Example Configuration

log "/var/log/bird.log" all;
log syslog all;

router id 123.124.125.126;
define myas = 12345;

protocol device { }

### The following function excludes weird networks such as
### rfc1918, class D, class E, and too long or too short prefixes

function avoid_martians()
prefix set martians;
{
martians = [ 169.254.0.0/16+, 172.16.0.0/12+, 192.168.0.0/16+, 10.0.0.0/8+,
224.0.0.0/4+, 240.0.0.0/4+, 0.0.0.0/32-, 0.0.0.0/0{25,32}, 0.0.0.0/0{0,7} ];

### Avoid RFC1918 and similar networks
if net ~ martians then return false;
return true;
}

function avoid_crappy_prefixes()
{
if net.len < 8 then return false;
if net.len > 24 then return false;
return true;
}

### Protocol Template

template bgp PEERS {
local as myas;
import all;
export all;
route limit 10000;
rs client;
}

### Generic Input Filter

filter bgp_in {
if avoid_martians() && avoid_crappy_prefixes() then accept;
else reject;
}

### BGP output filter (based on communities)

function bgp_out(int peeras)
{
if ! (source = RTS_BGP ) then return false;
if peeras > 65535 then return true; ### communities do not support AS32
if (0,peeras) ~ bgp_community then return false;
if (myas,peeras) ~ bgp_community then return true;
if (0, myas) ~ bgp_community then return false;
return true;
}

protocol bgp R_87654 from PEERS {
description "R_87654 - peer 1";
neighbor 123.124.125.200 as 87654;
import filter bgp_in;
export where bgp_out(87654);
}

protocol bgp R_76543 from PEERS {
description "R_76543 - peer 2";
neighbor 123.124.125.201 as 76543;
import filter bgp_in;
export where bgp_out(76543);
}

protocol bgp R_65432 from PEERS {
description "R_65432 - peer 3";
neighbor 123.124.125.202 as 65432;
import filter bgp_in;
export where bgp_out(65432);
}

protocol bgp R_54321 from PEERS {
description "R_54321 - peer 4";
neighbor 123.124.125.203 as 54321;
import filter bgp_in;
export where bgp_out(54321);
}