Pages

2015/12/11

Using exaBGP to control your routers

ExaBGP is a python implementation of the BGP protocol. You can run exaBGP on the server and establish BGP sessions to your routers. You can find the exaBGP source on the github.

https://github.com/Exa-Networks/exabgp

What you can do with it? You can for example use it to monitor the state of your network or to manipulate routes. You can find many use cases on the following link:

https://github.com/Exa-Networks/exabgp/wiki/Related-articles

To install exaBGP on your server use python pip.

pip install exabgp

The advantage of exaBGP is that it is very programmable. It transform BGP messages to text or JSON files. You can communicate with exaBGP with the API. To send commands to the exaBGP write these commands to STDOUT. To receive the data read the STDIN.

To begin with the exaBGP you need a configuration file. The configuration file specify the basic BGP settings for the server and basic neighbor settings. The example of the file is:

neighbor 192.168.1.1 {
    router-id 192.168.1.2;
    local-address 192.168.1.2;
    local-as 1;
    peer-as 1;
    graceful-restart;

    process routes {
        run ./routes.py
    }
}

With the neighbor command you specify the IP address of the neighbor. Inside the neighbor configuration you specify the router-id of the server, the IP address, which will be used by the server, local and remote AS number (you can use iBGP or eBGP session). The process command is mandatory. With process command you specify which external script will exaBGP run. You can run any script you want. You can use this script to write to the STDOUT, which will be captured by exaBGP and use this command to execute some tasks. You can run multiple scripts by using multiple process commands.

The example of the routes.py is:

import sys
import time

routes = [
'announce route 1.1.1.1/32 next-hop 192.168.1.10',
]

time.sleep(1)

for route in routes:
    sys.stdout.write(route + '\n')
    sys.stdout.flush()
    time.sleep(1)

while True:
    time.sleep(1)


The exaBGP will execute this script and this script will write the ‘announce …’ command to the STDOUT. This command will tell the exaBGP to announce this route to the BGP peer. And if you check your router after announcing this route, you can see this route in the BGP table.

You can also construct your configuration with the group parameters:

group DEMO {
    router-id 192.168.1.2;
    local-address 192.168.1.2;
    graceful-restart;

    neighbor 192.168.1.10 {
        local-as 65010;
        peer-as 65010;
    }

    neighbor 192.168.1.11 {
        local-as 65011;
        peer-as 65011;
    }

    process routes {
         run ./routes.py;
    }
}

As you can see, you can use different AS numbers on the BGP server. That is really the advantage of using exaBGP.

To run an exaBGP server use the following command:

exabgp demo.conf

This command will run the server and establish the BGP sessions with your routers.

ExaBGP is a great tool, if you want to have the programmable BGP implementation. The only thing that I am missing is the lack of documentation, and examples.

12 comments:

  1. Despite being reliable printing machines and despite your best of efforts, HP printers often malfunction. Why? There can be multiple reasons for HP printers to malfunction and display error messages.RouterReset

    ReplyDelete
  2. Today's network leaders know that modern demands on a network by its users can telescope the bandwidth noticeably. Faster computers, increased web sources and larger gates to the internet can deliver an intolerable tension on networks with reduced bandwidth access.
    assemblaggi

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete
  4. A few things are great. Some are incredible. At that point comes this blog.The Best In Tech

    ReplyDelete
  5. This is highly informatics, crisp and clear. I think that everything has been described in systematic manner so that reader could get maximum information and learn many things. our blog

    ReplyDelete
  6. This is my first time i visit here. I found so many interesting stuff in your blog especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the enjoyment here! keep up the good work TutuApp VIP Download

    ReplyDelete
  7. Excellent article. Very interesting to read. I really love to read such a nice article. Thanks! keep rocking. AppEven Download

    ReplyDelete
  8. If you have a cable modem, because your broadband service from your Internet Service Provider is a cable service then the setup is very similar, having already tested the functionality of the Cable Modem. wireless routers reviews

    ReplyDelete
  9. Awesome blog. I enjoyed reading your articles. This is truly a great read for me. I have bookmarked it and I am looking forward to reading new articles. Keep up the good work! appvn download

    ReplyDelete
  10. Tweakbox App is the one of the best ios,android App store to get the tons of free app and game. Here the latest version of tweakbox of free.
    Tweakbox Apk
    Tweakbox for ios
    Tweakbox for android

    ReplyDelete
  11. Whatsapp plus is one of the best mod app for official whatsapp for free, get unlimited features of

    whatsapp plus for free. Here Click to download the latest version whatsapp plus apk.
    WhatsApp Plus
    Download WhatsApp Plus

    ReplyDelete
  12. Just 20 years ago, horse racing and the lottery have been the only video games in town. But today, find a way to|you presumably can} drop $100 on the NFL playoffs, a Knicks or Nets game, or another sporting occasion on the planet, all with the contact of a telephone. Since voters permitted desk game casinos in New York in 2013, New York state authorized 카지노 seven licenses. Just four were issued to on line casino operators, all of them upstate. While the platform doesn’t have too many deposit strategies out there, withdrawals are significantly troublesome as there are solely three of them.

    ReplyDelete