-
Notifications
You must be signed in to change notification settings - Fork 448
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Need offical documentation and script examples for collecting BGP routes #262
Comments
Hello Victor, You may want to take a look at https://github.com/pyke369/exabgp-helpers/tree/master/exaprefixdb. This little ExaBGP helper script will actually dump the routes/prefixes received from an arbitrary number of BGP sessions in multiple files at a regular interval, relying on filters like ASPath, BGP community or BGP peers. It actually works fine with multiples copies of the global Internet public table, received from multiple routers with multiple Tier-1 transit links. I will add some documentation later, but there is an example configuration file (JSON-based) along with the corresponding ExaBGP configuration file. You may then export the generated text files into fast-lookup databases using https://github.com/pyke369/prefixdb for instance (this comes handy for SDN/applicative routing management). Cheers. |
@pyke369 how about integrating this tool within the exabgp repository ? I would be fine giving you commit access to be able to maintain the code. |
@pyke369 Are you sure there is no error in line 10 of exaprefixdb-sample.conf? I am almost sure there should be no comma there. |
@victor-sudakov yes, you are absolutely right:
I fixed it in the repository. Please note this already is an advanced configuration (with 4 BGP sessions and a lot of filtering). The simplest one you could start with is more like:
This will dump all received routes from all established BGP sessions in /tmp/all.db every 10 minutes. You could start with this and then introduce more complexity if needed. |
@thomas-mangin sure thing. let me just clean the repo. a little bit and push a small documentation first. |
@pyke369 I'm trying to test it with exabgp-3.4.8 with a simple config (see below) but my database comes out empty all the time. Any ideas why? exaprefixdb.conf: exabgp.conf: |
@victor-sudakov could you check the following please?
You may try to start ExaBGP in foreground mode ("exabgp_log_all=true exabgp exabgp.conf") and check the messages on the screen (search for routes updates). In addition, try to "kill -USR1 <exaprefixdb.py PID>" to activate additional syslog debug messages. For instance, this is the trace I get from a peer announcing the v4 default and private blocks routes:
Tested with ExaBGP v3.4.10:
|
Yes to your first three questions. Because the file /var/tmp/prefixdb/all.db is indeed being created, but it contains only a linefeed and no prefixes. It would not be created if there were permission or starting problems. As to the fourth question. The cisco router thinks it's sending prefixes to exabgp, but I cannot make sure it is receiving them. Sat, 16 May 2015 23:11:45 | WARNING | 96069 | daemon | Created PIDfile /var/run/exabgp/exabgp.pid with value 96072 |
And where did you learn about exabgp_log_all ? It's not found anywhere in the exabgp code as "pkg info -l exabgp | xargs grep -i exabgp_log_all" shows nothing. Neither does "exabgp /usr/local/etc/exabgp/exabgp.conf" start anything in the foreground. In FreeBSD exabgp is started from a rc.d script and looks like this in the ps output: 97002 ?? R 0:06,39 /usr/local/bin/python2.7 /usr/local/lib/python2.7/site-packages/exabgp/application/bgp.py --folder /usr/local/etc/exabgp /usr/local/etc/exabgp/exabgp.conf |
"exabgp_log_all=true" is just a way of setting an environment variable before starting the exabgp process itself. you can find about environment variables by just starting exabgp with no argument (see option 4) to set env. variables below).
I don't know about the specifics of the FreeBSD packaging (I'm using Linux), but you should probably stop the stock ExaBGP daemon first (using the rc.d script, something like "/etc/rc.d/exabgp stop") and then try:
(to make sure ExaBGP does not daemonize itself). As for your trace above, I don't see any "routes" messages showing routes updates from the Cisco router. Try adding "exabgp_log_routes=true" just in case (but "exabgp_log_all=true" should already take care of this). |
I don't see the environment variable "exabgp_log_all" anywhere in the exabgp code. How does it make sense? |
It must be some FreeBSD specific issue then. Look: $ /usr/local/sbin/exabgp Is there anything I can put into exabgp.conf itself to enable debug? |
Not in exabgp.conf directly, but in exabgp.env. This file should be located in the /etc/exabgp folder (and if it does not already exists, you can still use "exabgp --fi" to generate a first template and go from there).
|
Bingo, now I have a very detailed exabgp log with lots of updates. For some reason however, those updates are not passed to the script which I run from the "process" section. The only thing I see passed to this script is the line { "exabgp": "3.4.8", "time": 1431858703, "host" : "noc.sibptus.ru", "pid" : "3455", "ppid" : "1", "counter": 1, "type": "notification", "notification": "shutdown"} and then nothing. The exabgp log can be downloaded from ftp://ftp.sibptus.ru/pub/vas/exabgp.log.zip It's mostly a question to Thomas I guess. |
If you are running master make sure "parsed" is in your receive section. |
@thomas-mangin I have published the complete log at ftp://ftp.sibptus.ru/pub/vas/exabgp.log.zip |
Updates generated from ExaBGP itself are not send to the script. If you need this feature you need to use master and then to change the section from "receive" to "send" to see what was generated. |
@thomas-mangin I don't need updates generated by ExaBGP itself. I need updates received by ExaBGP from its two peers to be sent to the script. Let's consider the prefix 31.211.40.0/22 received by ExaBGP from 212.73.125.216 Sun, 17 May 2015 17:04:26 | INFO | 49814 | parser | parsed announce nlri 31.211.40.0/22 next-hop 213.183.111.225 payload 161F D328 Why is this prefix not sent to the script? |
Because the current parser is brain dead, put the process section before your neighbors and tell me if it fixes it. |
Yes, putting the process section before the neighbors fixes it. Who might think! |
Now exaprefixdb is also working as expected. Thank you guys! |
I will close this thread. Clearly no documentation was written but it is of little use for everyone and docs are a know issue - they do not need an entry here 😢 |
There is neither documentation nor script examples for collecting/saving BGP routes for further processing (like building src/dst ACLs for squid for example). I would like some to be provided in the distribution.
The text was updated successfully, but these errors were encountered: