diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4ddd643 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +exabgp.conf +venv +api-full-rrc14.run diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..8c46008 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +FROM python:3 + +RUN pip install exabgp +RUN mkdir -p /etc/exabgp && exabgp --fi > /usr/local/etc/exabgp/exabgp.env +RUN mkfifo /run/exabgp.in && \ + mkfifo /run/exabgp.out && \ + chmod 666 /run/exabgp.in && \ + chmod 666 /run/exabgp.out + +RUN apt update && apt install net-tools nano +COPY exabgp.env /usr/local/etc/exabgp/ + +ENTRYPOINT ["exabgp"] +CMD ["--help"] \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..0def1d8 --- /dev/null +++ b/README.md @@ -0,0 +1,31 @@ +## Clone +```bash +git clone +``` + +## Build +```bash +docker build -t exabgp-full-table . +``` +Copy and edit exabgp.conf.dist +```bash +cp exabgp.conf.dist exabgp.conf +``` +Extract api-full-rrc14.run.tgz +```bash +tar zxvpf api-full-rrc14.run.tgz +``` + +## Run +```bash +docker run -d --name exabgp --rm -v $(pwd)/exabgp.conf:/etc/exabgp/exabgp.conf -v $(pwd)/api-full-rrc14.run:/api-full-rrc14.run exabgp-full-table /etc/exabgp/exabgp.conf +``` + +## Generate data +Data was downloaded from RIPE RIS rrc14 (Palo Alto, CA) +[http://data.ris.ripe.net/rrc14/] + +mrtparse [https://github.com/t2mune/mrtparse] to convert to ExaBGP API format +```bash +./mrt2exabgp.py -P latest-bview.gz < api-full-rrc14.run +``` \ No newline at end of file diff --git a/api-full-rrc14.run.tgz b/api-full-rrc14.run.tgz new file mode 100644 index 0000000..46e59ff Binary files /dev/null and b/api-full-rrc14.run.tgz differ diff --git a/api.run b/api.run new file mode 100644 index 0000000..7ab2382 --- /dev/null +++ b/api.run @@ -0,0 +1,42 @@ +#!/usr/bin/env python + +import sys +import time + +msgs = [ +'announce route 1.0.0.0/24 origin IGP as-path [2914 13335 ] med 10 aggregator (13335:172.68.188.1) community [2914:410 2914:1008 2914:2000 2914:3000] next-hop 198.32.176.14', +'announce route 1.0.4.0/22 origin IGP as-path [2914 15412 4826 38803 56203 ] med 22001 community [2914:410 2914:1405 2914:2406 2914:3400] next-hop 198.32.176.14', +'announce route 1.0.4.0/24 origin IGP as-path [2914 15412 4826 38803 56203 ] med 22001 community [2914:410 2914:1405 2914:2406 2914:3400] next-hop 198.32.176.14', +'announce route 1.0.5.0/24 origin IGP as-path [2914 15412 4826 38803 56203 ] med 22001 community [2914:410 2914:1405 2914:2406 2914:3400] next-hop 198.32.176.14', +'announce route 223.255.248.0/24 origin IGP as-path [2914 6453 63199 ] med 23 community [2914:420 2914:1008 2914:2000 2914:3000 6453:3000 6453:3100 6453:3103] next-hop 198.32.176.14', +'announce route 223.255.249.0/24 origin IGP as-path [2914 6453 63199 ] med 23 community [2914:420 2914:1008 2914:2000 2914:3000 6453:3000 6453:3100 6453:3103] next-hop 198.32.176.14', +'announce route 223.255.250.0/24 origin IGP as-path [2914 6453 63199 ] med 23 community [2914:420 2914:1008 2914:2000 2914:3000 6453:3000 6453:3100 6453:3103] next-hop 198.32.176.14', +'announce route 223.255.251.0/24 origin IGP as-path [2914 6453 63199 ] med 23 community [2914:420 2914:1008 2914:2000 2914:3000 6453:3000 6453:3100 6453:3103] next-hop 198.32.176.14', +'announce route 223.255.252.0/24 origin IGP as-path [2914 4134 58519 ] med 21 community [2914:420 2914:1008 2914:2000 2914:3000] next-hop 198.32.176.14', +'announce route 223.255.253.0/24 origin IGP as-path [2914 4134 58519 ] med 21 community [2914:420 2914:1008 2914:2000 2914:3000] next-hop 198.32.176.14', +'announce route 223.255.254.0/24 origin IGP as-path [2914 4657 55415 55415 55415 55415 55415 55415 55415 ] med 21990 community [2914:410 2914:1405 2914:2406 2914:3400] next-hop 198.32.176.14' +] + +# while msgs: +# msg = msgs.pop(0) +# if isinstance(msg, str): +# sys.stdout.write(msg + '\n') +# sys.stdout.flush() +# else: +# time.sleep(msg) +messages = [ + 'announce route 100.10.0.0/24 next-hop self', + 'announce route 200.20.0.0/24 next-hop self', +] + +time.sleep(1) + +#Iterate through messages +for message in messages: + sys.stdout.write(message + '\n') + sys.stdout.flush() + time.sleep(1) + +while True: + time.sleep(1) + diff --git a/exabgp.conf.dist b/exabgp.conf.dist new file mode 100644 index 0000000..a140d9c --- /dev/null +++ b/exabgp.conf.dist @@ -0,0 +1,21 @@ +process announce-routes { + run python api-full-rrc14.run; + encoder text; + } + + +neighbor {neighbor IP} { + router-id {local host IP}; + local-address 172.17.0.2; #Docker container IP + local-as {local AS}; + peer-as {remote AS}; + hold-time 90; + family { + ipv4 unicast; + ipv6 unicast; + } + + api { + processes [announce-routes]; + } +} diff --git a/exabgp.env b/exabgp.env new file mode 100644 index 0000000..69a8b66 --- /dev/null +++ b/exabgp.env @@ -0,0 +1,57 @@ + +[exabgp.api] +ack = false +chunk = 1 +cli = true +compact = false +encoder = json +respawn = true +terminate = false + +[exabgp.bgp] +openwait = 60 + +[exabgp.cache] +attributes = true +nexthops = true + +[exabgp.daemon] +daemonize = false +drop = true +pid = '' +umask = '0o137' +user = 'nobody' + +[exabgp.log] +all = false +configuration = true +daemon = true +destination = 'stdout' +enable = true +level = INFO +message = false +network = true +packets = false +parser = false +processes = true +reactor = true +rib = false +routes = false +short = false +timers = false + +[exabgp.pdb] +enable = false + +[exabgp.profile] +enable = false +file = '' + +[exabgp.reactor] +speed = 1.0 + +[exabgp.tcp] +acl = false +bind = '' +exonce = false +port = 179