Strony

Sunday, 24 May 2020

BIRD - installation and configuration

This post is about BIRD Internet Routing Daemon.

Topics which will be covered:
- BIRD installation on Ubuntu server
- setting up BGP peering between two servers with BIRD installed
- synchronization of BGP learned route with kernel forwarding table

Installation:

BIRD PPA repository will be added to install BIRD version 1.6.8 .
To have access to add-apt-repository tool - package software-properties-common is installed.

Instalaltion commands:
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:cz.nic-labs/bird
sudo apt-get update
sudo apt-get install bird

Set bird to start at every boot and launch it:
sudo systemctl enable bird
sudo systemctl start bird

BIRD configuration is located in file /etc/bird/bird.conf .

Configuration:

In example two routers are present:
- bird01 with IP 192.168.122.101
- bird02 with IP 192.168.122.102

Default BIRD routing table master is used.
iBGP session will be established between bird01 and bird02.
bird02 will synchronize route received via BGP to kernel forwarding table.

Configuration for bird01:
router id 192.168.122.101;

protocol device {
scan time 10;
}

protocol static {
import all; # import routes from protocol static to table master
route 1.2.3.0/24 via 192.168.122.1;
}

protocol bgp {
local as 65001;
direct; # neighbor is directly connected
export all; # export routes from table master to protocol bgp
neighbor 192.168.122.102 as 65001;
}

Additionally to section with BGP settings (protocol bgp), there are two more protocols present:
- protocol device - for getting information about network interfaces from kernel
- protocol static - for manually defining routes

Configuration for bird02:

router id 192.168.122.102;

protocol device {
scan time 10;
}

protocol kernel {
scan time 60;
export all; # export routes from table master to protocol kernel
}

protocol bgp {
local as 65001;
direct;
import all; # import routes from protocol bgp to table master
neighbor 192.168.122.101 as 65001;
}

BIRD routing table master is not responsible for forwarding traffic (it is not kernel forwarding table).
To forward traffic by routes present in BIRD routing table - Kernel protocol is used to synchronize it with kernel forwarding table.

Verification:

On router bird02 it will be verified if route was received via BGP and if it was synchronized with kernel forwarding table.

Tool birdc can be used to control bird (configure is used to reload configuration):
test@bird02:~$ sudo birdc
BIRD 1.6.8 ready.

bird> configure
Reading configuration from /etc/bird/bird.conf
Reconfiguration in progress

Display information about configured protocols:
bird> show protocols
name     proto    table    state  since       info
device1  Device   master   up     09:31:37  
kernel1  Kernel   master   up     09:31:37  
bgp1     BGP      master   up     09:31:40    Established

Display information about routes in table master:
bird> show route table master
1.2.3.0/24         via 192.168.122.1 on enp1s0 [bgp1 09:31:40 from 192.168.122.101] * (100) [i]
bird> exit

Verify in Ubuntu routing table, that route learned by BIRD is present:
test@bird02:~$ ip route
default via 192.168.122.1 dev enp1s0 proto static
1.2.3.0/24 via 192.168.122.1 dev enp1s0 proto bird
192.168.122.0/24 dev enp1s0 proto kernel scope link src 192.168.122.102

Links:
https://bird.network.cz/
https://launchpad.net/~cz.nic-labs/+archive/ubuntu/bird

No comments:

Post a Comment