20.09.2018

Subnet collection from BGP

We offer this feature out of the box for FastNetMon Advanced. For Community edition you can use this guide instead.

Also, we prepared proof of concept code which can help you with this issue for Community edition and read fresh data directly from BGP session.

Install ExaBGP 3:

apt-get install python-pip
pip install exabgp==3.4.20

Download configs and scripts:

wget https://raw.githubusercontent.com/pavel-odintsov/fastnetmon/master/src/scripts/exabgp_network_collector.conf -O/etc/exabgp_network_collector.conf
wget https://raw.githubusercontent.com/pavel-odintsov/fastnetmon/master/src/scripts/bgp_network_retriever.py -O/usr/local/bin/bgp_network_retriever.py
wget https://raw.githubusercontent.com/pavel-odintsov/fastnetmon/master/src/scripts/bgp_network_collector.py -O/usr/local/bin/bgp_network_collector.py

chmod +x /usr/local/bin/bgp_network_retriever.py /usr/local/bin/bgp_network_collector.py

Then, open /etc/exabgp_network_collector.conf and specify your BGP peering session configuration.

Run ExaBGP:

cd /usr/src/exabgp
env exabgp.log.level=DEBUG exabgp.daemon.user=root exabgp.tcp.bind="0.0.0.0" exabgp.tcp.port=179 exabgp.daemon.daemonize=false exabgp.daemon.pid=/var/run/exabgp.pid exabgp.log.destination=/var/log/exabgp.log exabgp /etc/exabgp_network_collector.conf

Wait a few minutes while all route announcements are received (depends on route server size)

Retrieve learned networks from database located at /var/lib/bgp_network_collector.db:

python /usr/local/bin/bgp_network_retriever.py