How To Install and Run BGP Daemon on Cloud Server

Learn how to run the BGP daemon on your cloud server to establish a BGP session with Heficed routers and announce your IPv4 and/or IPv6 ranges from your AS.

BGP daemon BIRD

Requirements:

  • Create RPKI and route objects for your IPv4 and/or IPv6 ranges with your AS number as origin.
  • Make sure you are running CentOS 7 in your server since this article is based on CentOS 7 OS. Note that configuration is similar on different Linux versions.

Before you proceed, submit a ticket from your Terminal requesting to create a BGP session with your server by providing the following information:

  • The main IP address of your server
  • Your public AS number.
  • Your IPv4 and/or IPv6 ranges
  • A BGP session password
  • What you wish to receive via a BGP session:
    1. full table;
    2. full table and default gateway;
    3. only default gateway;
    4. nothing.

Once the BGP session is created, proceed with the following steps.

Connect to your server and change the network configuration from DHCP to static. Open file /etc/sysconfig/network-scripts/ifcfg-eth0 to edit:

[root@hhvya97bbk ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0

The file should look like this:

# Created by cloud-init on instance boot automatically, do not edit.
#
BOOTPROTO=dhcp
DEVICE=eth0
HWADDR=06:f3:42:00:01:4c
ONBOOT=yes
TYPE=Ethernet
USERCTL=no

Change the settings for static configuration by replacing the values with your IPv4 and IPv6 addresses.

# Created by cloud-init on instance boot automatically, do not edit.
#
BOOTPROTO=static
HWADDR=06:f3:42:00:01:4c
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
IPADDR=2.58.28.45
GATEWAY=2.58.28.1
NETMASK=255.255.255.0
IPV6INIT=yes
IPV6ADDR=2a03:fbc6:1:829a::/48
IPV6_DEFAULTGW=2a03:fbc6:1:8000:8000::1

Edit file /etc/cloud/cloud.cfg and add the following lines at the end:

network:
config: disabled

Restart the server to apply the changes:

[root@hhvya97bbk ~]# reboot

Log in to the server and confirm if IPv4 and IPv6 connectivity is working:

[root@hhvya97bbk ~]# ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=117 time=1.24 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=117 time=1.18 ms
^C
--- 8.8.8.8 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 1.188/1.218/1.249/0.046 ms

[root@hhvya97bbk ~]# ping6 2001:4860:4860::8888
PING 2001:4860:4860::8888(2001:4860:4860::8888) 56 data bytes
64 bytes from 2001:4860:4860::8888: icmp_seq=1 ttl=117 time=2.31 ms
64 bytes from 2001:4860:4860::8888: icmp_seq=2 ttl=118 time=0.522 ms
^C
--- 2001:4860:4860::8888 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 0.522/1.420/2.318/0.898 ms

Add your IPv4 and/or IPv6 ranges to the network interface:

[root@hhvya97bbk ~]# ip addr add 191.96.202.0/24 dev eth0
[root@hhvya97bbk ~]# ip -6 addr add 2a0e:1c04:1::/48 dev eth0

Update the repository and install the bird daemon by running the following commands one by one:

yum -y update
yum -y install bird

Open file /etc/bird.conf and append the file with the following lines. Make sure to replace the example IP addresses and IP ranges with your actual IP data, AS number and BGP password.

log syslog all;

#Router ID = server main IP address
router id 2.58.28.45;

protocol device {
scan time 10; # Scan interfaces every 10 seconds
}

#Disable automatically generating direct routes to all network interfaces.
protocol direct {
disabled; # Disable by default
}

#Forbid synchronizing BIRD routing tables with the OS kernel.
protocol kernel {
import all; # Import to table, default is import all
export all; # Export to protocol. default is export none
}

#Route your subnet via your server main IP address
protocol static {
route 191.96.202.0/24 via 2.58.28.45;
}

#local = your server main IP address and your AS number
#neighbor = gateway of your server main IP address and Heficed AS number which is 61317 by default
#password = BGP session password
protocol bgp Heficed {
description "BGP session to Heficed";
local 2.58.28.45 as 397727;
neighbor 2.58.28.1 as 61317;
password "YOUR-BGP-PASSWORD";
import filter { print "importing"; accept; };
export filter { print "exporting"; accept; };
}

Save the file and close it. Apply the changes using the following command:

systemctl restart bird

Check if the bird daemon is running:

systemctl status bird
● bird.service - BIRD Internet Routing Daemon
Loaded: loaded (/usr/lib/systemd/system/bird.service; disabled; vendor preset: disabled)
Active: active (running) since Sat 2021-06-26 08:58:02 UTC; 1s ago
Main PID: 22910 (bird)
CGroup: /system.slice/bird.service
└─22910 /usr/sbin/bird -f -u bird -g bird

Jun 26 08:58:02 hhvya97bbk systemd[1]: Started BIRD Internet Routing Daemon.
Jun 26 08:58:02 hhvya97bbk bird[22910]: Started

Enter the bird console with the command birdc:

# birdc
BIRD 1.6.8 ready.
bird>

Check if a BGP session is established with command show protocol all Heficed:

bird> show protocol all Heficed
name proto table state since info
Heficed BGP master up 08:58:07 Established
Description: BGP session to Heficed
Preference: 100
Input filter: (unnamed)
Output filter: (unnamed)
Routes: 1 imported, 1 exported, 1 preferred
Route change stats: received rejected filtered ignored accepted
Import updates: 1 0 0 0 1
Import withdraws: 0 0 --- 0 0
Export updates: 2 1 0 --- 1
Export withdraws: 0 --- --- --- 0
BGP state: Established
Neighbor address: 2.58.28.1
Neighbor AS: 61317
Neighbor ID: 141.98.88.124
Neighbor caps: refresh restart-aware llgr-aware AS4
Session: external AS4
Source address: 2.58.28.45
Hold timer: 56/90
Keepalive timer: 30/30

bird>

That is it. Your BGP IPv4 session is established, and your IPv4 IP range should be visible in the global routing table.

To establish an IPv6 BGP session, install the bird6 package using the command below:

yum -y install bird6

Edit configuration file /etc/bird6.conf and append the file with the following lines. Make sure you replace the example IP addresses and IP ranges with your actual IP data, AS number and BGP password.

log syslog all;

#Router ID = server main IPv4 address
router id 2.58.28.45;

protocol device {
scan time 10; # Scan interfaces every 10 seconds
}

#Disable automatically generating direct routes to all network interfaces.
protocol direct {
disabled; # Disable by default
}

#Forbid synchronizing BIRD routing tables with the OS kernel.
protocol kernel {
import all; # Import to table, default is import all
export all; # Export to protocol. default is export none
}

#Route your subnet via your server main IP address
protocol static {
route 2a0e:1c04:1::/48 via 2a03:fbc6:1:829a::;
}

#local = your server main IP address and your AS number
#neighbor = gateway of your server main IP address and Heficed AS number which is 61317 by default
#password = BGP session password
protocol bgp Heficed {
description "BGP session to Heficed";
local 2a03:fbc6:1:829a:: as 397727;
neighbor 2a03:fbc6:1:8000:8000::1 as 61317;
password "YOUR-BGP-PASSWORD";
import filter { print "importing"; accept; };
export filter { print "exporting"; accept; };
}

Apply the changes using the following command:

systemctl restart bird6

Confirm if the bird6 daemon is running:

# systemctl status bird6
● bird6.service - BIRD Internet Routing Daemon
Loaded: loaded (/usr/lib/systemd/system/bird6.service; disabled; vendor preset: disabled)
Active: active (running) since Sat 2021-06-26 09:20:11 UTC; 3s ago
Main PID: 23161 (bird6)
CGroup: /system.slice/bird6.service
└─23161 /usr/sbin/bird6 -f -u bird6 -g bird6

Jun 26 09:20:11 hhvya97bbk systemd[1]: Started BIRD Internet Routing Daemon.
Jun 26 09:20:11 hhvya97bbk bird6[23161]: Started

Enter the bird6 console with command and check if the session is established:

# birdc6
BIRD 1.6.8 ready.
bird> show protocol all Heficed
name proto table state since info
Heficed BGP master up 09:20:15 Established
Description: BGP session to Heficed
Preference: 100
Input filter: (unnamed)
Output filter: (unnamed)
Routes: 1 imported, 1 exported, 1 preferred
Route change stats: received rejected filtered ignored accepted
Import updates: 1 0 0 0 1
Import withdraws: 0 0 --- 0 0
Export updates: 4 2 0 --- 2
Export withdraws: 0 --- --- --- 1
BGP state: Established
Neighbor address: 2a03:fbc6:1:8000:8000::1
Neighbor AS: 61317
Neighbor ID: 141.98.88.124
Neighbor caps: refresh restart-aware llgr-aware AS4
Session: external AS4
Source address: 2a03:fbc6:1:829a::
Hold timer: 80/90
Keepalive timer: 9/30

bird>

That is it. Your IPv6 BGP session is established, and your IPv6 range should be visible in the global routing table.

Was this article helpful?

Need support?

If you need any further help, don't hesitate to send a support request to our support team.