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.

Preflight, eligibility, and route scope

Select GRE + BGP when creating the tunnel. BGP cannot be added to an existing non-BGP tunnel. First ensure the GRE tunnel is up and that the Dashboard-provided peer address is reachable across it; the BGP protocol reaching Established is the readiness check for the tunnel BGP session.

Each configured backend has its own BGP session. X4B selects an eligible online backend using the configured local preference, so a lower-preference online backend can provide failover when the preferred session is unavailable. For an Anycast service with Unified Tunnels, the required spoke topology also affects outbound traffic: use a spoke in every available location and preserve the connection-aware return routing described in Tunnels.

The private BGP session is for X4B tunnel routing and is separate from announcing a public prefix to the Internet. A /32 service can use BGP for internal backend failover, but cannot announce a global /24+ prefix. If you want to use your own ASN, provide ownership evidence and a Letter of Authorisation (LOA) to support. Customer-owned prefixes or BYOIP are eligibility-by-review: /24+ is an Internet-routing technical threshold, not a public provisioning promise, and support must review any requested prefix announcement first. See Routing and BGP for the distinction between tunnel BGP and global routing.

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

Safe diagnostic information for support

For a BGP issue, include the service and tunnel identifier, affected region, time and timezone, peer reachability result, BIRD protocol state, and a redacted summary of the export filter. Do not send complete BIRD configurations, credentials, private routing material, generated tunnel configuration, or customer traffic.