Read a BGP live stream from CAIDA and insert them into a BGP session
What do we need
  bgpreader from the bgpstream core package provided by Caida
  bgp_simple.pl obtained in github
  We will read the BGP live stream feed using bgpreader, then the standard output of it will be redirected to a pipe file (mkfifo) where a perl script called bgpsimple will be reading this file. This very same script will established the BGP session against a BGP speaker and announce the prefixes received in the stream.
LAB Topology
  The configuration was already tested in Cisco & Quagga
  The BGP Speaker (Cisco/Quagga) has the IPv4 address
  The BGP Simple Linux box has the IP
How does it works?
  bgpreader has the ability to write his output in the -m format used by libbgpdump (by RIPENCC), this is the very same format bgpsimple uses as stdin. That's why myroutes is a PIPE file (created with mkfifo).
First install general some packages:
apt-get install apt-file libsqlite3-dev libsqlite3 libmysqlclient-dev libmysqlclient
apt-get install libcurl-dev libcurl  autoconf git libssl-dev
apt-get install build-essential zlib1g-dev libbz2-dev
apt-get install libtool git
apt-get install zlib1g-dev
Also intall wandio
git clone https://github.com/alistairking/wandio
cd wandio
./configure && ./make && ./make install
wandiocat http://www.apple.com/library/test/success.html
to test wandio:
wandiocat http://www.apple.com/library/test/success.html
Download bgp reader tarball from:
#ldconfig (before testing)
#mkfifo myroutes
to test bgpreader:
./bgpreader -p caida-bmp -w 1453912260 -m
(wait some seconds and then you will see something)
# git clone https://github.com/xdel/bgpsimple
Finally run everything
In two separate terminals (or any other way you would like to do it):
./bgpreader -p caida-bmp -w 1453912260 -m > /usr/src/bgpsimple/myroutes
./bgp_simple.pl -myas 65000 -myip -peerip -peeras 65000 -p myroutes
One more time, what will happen behind this?
bgpreader will read an online feed from a project called caida-bmp with starting timestamp 1453912260 (Jan 27 2016, 16:31) in "-m" format, It means a libbgpdump format (see references). The stardard output of all this will be send to the file /usr/src/bgpsimple/myroutes which is a "pipe file". At the same time, bgp_simple.pl will create an iBGP session againts peer (a bgp speaker such as Quagga or Cisco). bgp_simple.pl will read myroutes files and send what it seems in this file thru the iBGP Session.
Important information
- The BGP Session won't be established until there is something in the file myroutes
- eBGP multi-hop session are allowed
- You have to wait short time (few seconds) until bgpreaders start to actually see something and bgp_simple.pl starts to announce to the BGP peer
References / More information
-Part of the work was based on:
- Caida BGP Stream
- bgpreader info
- RIPE NCC libbgpdump:
- Introduction of "Named Pipes" (pipe files in Linux):