FastNetMon

Sunday, 26 April 2015

How to control ExaBGP from external tool?

Please setup ExaBGP and Quagga before this manual: http://www.stableit.ru/2015/04/quagga-bgp-and-exabgp-work-together-for.html

Let's create fake process which work as proxy for relying data from Linux PIPE to ExaBGP:

vim /etc/exabgp/exabgp_pipe_provider.sh
With this contents:
#!/bin/sh

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

rm -f $FIFO
mkfifo $FIFO
tail -f $FIFO
Set exec flag:

chmod +x /etc/exabgp/exabgp_pipe_provider.sh
And add 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;
    }  
}
And run ExaBGP!

After this we could see multiple processes in 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!

Let's add 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 please use this syntax:

echo "withdraw route 10.10.10.123/32" > /var/run/exabgp.cmd
After announce route we could see on Quagga side new prefix:
*> 10.10.10.123/32  10.0.3.114                             0 65001 i
Source: https://github.com/Exa-Networks/exabgp/wiki/Controlling-ExaBGP-:-using-a-named-PIPE

No comments :

Post a Comment

Note: only a member of this blog may post a comment.