I was playing around with Quagga, when I realized how disappointing it could be. My co-worker Ben then mentioned BIRD, a Czech project which does about the same thing, only this one actually works 😉

Granted, the syntax is like nothing you’ve seen before and may be pretty hard to grasp, but the sample config files will definitely help you get started. What does this baby do, you ask ? No less than: BGP, RIP, OSPF, static routing, and supports both IPv4 and IPv6. There’s also a shell that will help you query the daemon.

This post is by no means a manual or anything, I just wanted to spread the word!

Here’s a simple config example (where MY_IP, MY_AS, MY_NEIGHBOR and REMOTE_AS are values you need to set):

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

router id MY_IP;
define myas = MY_AS;

function avoid_martians()
prefix set martians;
{
        martians = [ 169.254.0.0/16+, 10.0.0.0/8+, 172.16.0.0/12+, 192.168.0.0/16+, 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 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;
}

filter bgp_out
{
        if net = 10.0.200.0/24 then accept;
        else reject;
}

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

protocol kernel {
        export all;
}

# This pseudo-protocol watches all interface up/down events.
protocol device {
        scan time 10;           # Scan interfaces every 10 seconds
}

# Static routes (again, there can be multiple instances, so that you
# can disable/enable various groups of static routes on the fly).
protocol static {
        # Guess what? You can reach me via me!
        route 10.0.200.0/24 via 10.0.200.1;
}

# Transit
protocol bgp {
        local as myas;
        description "VM TRANSIT";
        neighbor MY_NEIGHBOR as REMOTE_AS;
        route limit 100;
        import filter bgp_in;
        export filter bgp_out;
}

Then, just a few commands to use with birdc, the BIRD shell:

show protocols all
show protocols bgp1
show route preexport bgp1

Enjoy :)