ExaBGP / Erco Configuration
Below you’ll find the steps to install ExaBGP on ubuntu as well as install the Erco frontend for it so you don’t have to worry about the cli to announce/withdraw any routes. Make sure to update the files/scripts below with the relevant paths for your setup.
OS: Ubuntu 22.04
ExaBGP : 4.2.17
Python : 3.10.6
Install ExaBGP
apt update
apt upgrade -y
apt install python3-pip
apt install python3-exabgp
Install Erco
apt-get install build-essential
cPan Carton
git clone https://framagit.org/luc/erco.git
cd erco
carton install --deployment
cp erco.conf.template erco.conf
cp utilities/init/erco.service /etc/systemd/system
systemctl daemon-reload
systemctl enable erco.service
systemctl start erco
apt install nginx
cp utilities/nginx/erco.conf /etc/nginx/sites-available/
ln -s /etc/nginx/sites-available/erco.conf /etc/nginx/sites-enabled/
nano nginx -t && nginx -s reload
Erco SystemD file
nano /etc/systemd/system/erco.service
[Unit]
Description=Erco
Documentation=https://erco.xyz/doc/index.html
#Requires=network.target exabgp.service
After=network.target
[Service]
Type=forking
User=root
RemainAfterExit=yes
WorkingDirectory=/opt/erco/
PIDFile=/opt/erco/script/hypnotoad.pid
ExecStart=/usr/local/bin/carton exec hypnotoad script/erco
ExecStop=/usr/local/bin/carton exec hypnotoad -s script/erco
ExecReload=/usr/local/bin/carton exec hypnotoad script/erco
[Install]
WantedBy=multi-user.target
Erco Nginx Config
server {
listen 80;
listen [::]:80;
index index.html;
root /root/erco/templates/layouts;
server_name set_hostname_here;
location / {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://127.0.0.1:8080;
}
}
Once Erco is setup, make sure you edit the erco.conf file to setup your next-hops, communities, exabgp pid and conf file paths.
ExaBGP SystemD File
[Unit]
Description=ExaBGP
Documentation=man:exabgp(1)
Documentation=man:exabgp.conf(5)
Documentation=https://github.com/Exa-Networks/exabgp/wiki
After=network.target
ConditionPathExists=/etc/exabgp/exabgp.conf
[Service]
Environment=exabgp_daemon_daemonize=false
Environment=exabgp.daemon.pid=/var/run/exabgp/exabgp.pid
ExecStartPre=-/bin/mkdir /run/exabgp
ExecStartPre=/bin/bash -c "/usr/bin/mkfifo -m 0666 /run/exabgp/exabgp.{in,out}"
ExecStopPost=/bin/bash -c "/bin/rm -f /run/exabgp/exabgp.{in,out}"
ExecStart=/usr/sbin/exabgp /etc/exabgp/exabgp.conf
ExecReload=/bin/kill -USR1 $MAINPID
[Install]
WantedBy=multi-user.target
ExaBGP Config File
process socket {
run "/root/erco/utilities/bin/exabgp-ws-server";
}
template {
neighbor change-name-here {
api {
processes [ socket ];
}
local-as 65533;
peer-as your-asn-here;
hold-time 180;
group-updates false;
static {
#ERCO CONTROLLED PART
#END OF ERCO CONTROLLED PART
}
}
}
neighbor x.x.x.x {
inherit change-name-here;
description "test";
router-id z.z.z.z;
local-address z.z.z.z;
}
Script to start ExaBGP
#!/bin/bash
mkfifo /var/run/exabgp/exabgp.in
mkfifo /var/run/exabgp/exabgp.out
chmod 600 /var/run/exabgp/*
env exabgp.log.destination=/var/log/exabgp.log exabgp.daemon.user=root exabgp.daemon.daemonize=true exabgp.daemon.pid=/var/run/exabgp.pid exabgp /etc/exabgp/exabgp.conf
Script to check if ExaBGP is running and restart if not
#!/bin/bash
service=/usr/sbin/exabgp
if (( $(ps -ef | grep -v grep | grep $service | wc -l) > 0 ))
then
echo "$service is running!!!"
else
/root/exabgp.sh
fi