Setting up Bird BGP on Linux with a X4B GRE Tunnel

Border Gateway Protocol is a standardised protocol for exchanging routing and availability information. Bird is a BGP client available for Linux. This is a tutorial for using Bird with a GRE + BGP Tunnel provided by X4B. Please note, BGP for GRE tunnels is optional.

NOTE: BGP tunnels on /32 services are for internal failover purposes only. No announcement of global /24+ is possible on these services.

Step 1:

Setup desired configuration within the X4B Client Area for your Tunnel and Ports. Be sure to select "GRE + BGP" for the Tunnel type to enable BGP. For more information on setting up tunnels see the Tunnels KB page.

Step 2:

Install the tunnel.sh, or manually create the appropriate GRE tunnels. You should be able to ping the provided peering IP (ours) over this GRE tunnel.

Step 3:

Install Bird, on debian this is done with the following command:

sudo apt-get install bird

You may wish to use a newer version of bird than is provided in the Debian repositories.

Step 4:

Configure bird for your session with X4B. Bird configuration files can be found in /etc/bird on debian, the configuration file for IPv4 may be called bird.conf or bird4.conf depending on your platform.

Below there are two options for configuring bird, append your desired configuration to the end of the bird configuration file. If you are in doubt the Static route configuration is more fool proof.

Example Bird Configuration (Option 1: Automatic Import):

protocol direct {
    interface "gre*";
}

protocol bgp x4b_bgp {
    local <YOUR_BGP_PEER> as <YOUR_BGP_AS>;
    neighbor <OUR_BGP_PEER> as 64514;
    multihop;
    import none;
    export filter {
        if (net ~ [10.17.0.0/16+]) && (net.len < 32) then {
            accept;
        }
        reject;
    };
}

Example Bird Configuration (Option 2: Static Routes):

protocol static {
    route <SUBNET> reject;
    import all;
    export none;
}

protocol bgp x4b_bgp {
    local <YOUR_BGP_PEER> as <YOUR_BGP_AS>;
    neighbor <OUR_BGP_PEER> as 64514;
    multihop;
    import none;
    export filter {
        if (net ~ [10.17.0.0/16+]) && (net.len < 32) then {
            accept;
        }
        reject;
    };
}

Step 5:

Reload configuration in your BGP client, with bird:

root@nl:/etc/bird# birdc configure
BIRD 1.4.5 ready.
Reading configuration from /etc/bird/bird.conf
Reconfigured

Step 6:

Check your session is now established by using the command show protocols:

root@nl:/etc/bird# birdc show protocols x4b_bgp
BIRD 1.4.5 ready.
name     proto    table    state  since       info
x4b_bgp BGP      master   up     19:38:41    Established