cd /root/irsyad.eu/blog

Network Configuration Blog

First BGP Session with BIRD

Published: January 19, 2025Category: BGP Configuration

To get your first BGP Session up and running you will need the following ready:

  • Your own ASN
  • Your peers ASN (eg. your VPS providers ASN)
  • Peering IPs (provided by peer usually)
  • A prefix you plan to announce

Bird is easy to use and features a config file like syntax.

To install bird on Debian run as root:

bash
apt install bird

The bird config is stored in /etc/bird/bird.conf and /etc/bird/bird6.conf on Bird 1.6.x

Below is a simple BIRD BGP Config with one Upstream and a single Prefix announcement. You can use and adapt this example for both v4 and v6. You will need to replace the variables written in all caps with your ASNs, IPs etc.

The following examples are specific for Bird 1.6.x.

bird.conf (Bird 1.6.x)
router id YOUR-ROUTER-IP;

protocol device {
    scan time 10;
}

protocol kernel {
    export all;
    scan time 15;
}

protocol static announcement {
    import all;
    route YOURPREFIX reject;
}

protocol bgp upstream {
    import filter {
        accept;
    };
    export limit 10;
    export filter {
        if proto = "announcement" then accept;
    };
    local as YOUR-ASN;
    source address ROUTER-IP;
    graceful restart on;
    neighbor UPSTREAM-IP as UPSTREAM-ASN;
}

Useful Bird commands:

bash
# Configure Bird with the config set in /etc/bird/bird.conf
birdc configure

# Show the Status of the BGP protocols
birdc show proto

# Show all routes you export to a specific upstream/peer
birdc show route export PROTONAME

# Shows all paths for 1.1.1.0/24 with details such as next-hop, communities and preference
birdc show route 1.1.1.0/24 all

# For the IPv6 CLI on Bird 1.x use birdc6

Bird 2 Config Example:

bird.conf (Bird 2.x)
router id ROUTER-ID;

protocol device { 
    scan time 5; 
}

protocol direct { 
    ipv4; 
}

protocol direct { 
    ipv6; 
}

protocol static {
    ipv4;
    route $YOUR_V4_PREFIX reject;
}

protocol static {
    ipv4;
    route $YOUR_V6_PREFIX reject;
}

filter YOURASNv4 {
    if (net ~ [ $YOUR_V4_PREFIX ]) then accept;
    else reject;
}

filter YOURASNv6 {
    if (net ~ [ $YOUR_V6_PREFIX ]) then accept;
    else reject;
}

protocol bgp BGPTunnelV4 {
    local 10.249.1.2 as YOURASN;
    neighbor 10.249.1.1 as PEERASN;
    ipv4 {
        import all;
        export filter YOURASNv4;
    };
}

protocol bgp BGPTunnelV6 {
    local 2a0c:9a40:a001::2 as YOURASN;
    neighbor 2a0c:9a40:a001::1 as PEERASN;
    ipv6 {
        import all;
        export filter YOURASNv6;
    };
}

Note: Remember to replace all variables in CAPS with your actual values before using these configurations in production.

Coming Soon

OSPF Configuration Guide

Learn how to configure OSPF routing protocol with practical examples and best practices.

Coming Soon

MPLS L3VPN Setup

Step-by-step guide to implementing MPLS L3VPN with Juniper and Cisco equipment.