Controlling ExaBGP from external tool

Set up ExaBGP and Quagga before proceeding with this guide, using this manual.

Here, we are creating a fabricated process which works as a proxy for relying on data from Linux PIPE to ExaBGP:

vim /etc/exabgp/exabgp_pipe_provider.sh

With this content:

#!/bin/sh

FIFO="/var/run/exabgp.cmd"
#trap "rm -f $FIFO" SIGINT

rm -f $FIFO
mkfifo $FIFO
tail -f $FIFO

Setting exec flag:

chmod +x /etc/exabgp/exabgp_pipe_provider.sh

And adding the following (process service-dynamic ….) to ExaBGP config: /etc/exabgp_blackhole.conf

group Core_v4 {
    hold-time 180;
    local-as 65001;
    peer-as 1234;
    router-id 10.0.3.114;
    graceful-restart 1200;

    static {
        route 10.10.10.1/32 next-hop 10.0.3.114 community 65001:666;
    }   

    neighbor 10.0.3.115 {
        local-address 10.0.3.114;
        description "Quagga";
    }   

    # Add this line for process management
    process service-dynamic {
        run /etc/exabgp/exabgp_pipe_provider.sh;
    }   
}

At this point, we run ExaBGP.

Now, we can see multiple processes in the process list:

ps aux|grep exa
root     36854  0.0  0.0  52764 14604 ?        S    11:47   0:00 /usr/bin/python /usr/local/bin/exabgp /etc/exabgp_blackhole.conf
root     36855  0.0  0.0   4328   868 ?        S    11:47   0:00 /bin/sh /etc/exabgp/exabgp_pipe_provider.sh
root     36858  0.0  0.0   5800  1324 ?        S    11:47   0:00 tail -f /var/run/exabgp.cmd

We are ready to add the announce:

echo "announce route 10.10.10.123/32 next-hop 10.0.3.114 community 65001:666" > /var/run/exabgp.cmd

If you want to disable it, you can use this syntax:

echo "withdraw route 10.10.10.123/32" > /var/run/exabgp.cmd

After the route announce, we can see on Quagga a new prefix:

*> 10.10.10.123/32  10.0.3.114                             0 65001 i