Difference between revisions of "ExaBGP"
From HackerNet
Helikopter (talk | contribs) |
Helikopter (talk | contribs) m |
||
Line 1: | Line 1: | ||
− | ExaBGP är en BGP route announcer som det går att scripta mot. | + | ExaBGP är en BGP route announcer som det går att scripta mot. Se även [[Cisco_BGP|Cisco BGP]]. |
=Installation= | =Installation= |
Revision as of 14:46, 10 April 2016
ExaBGP är en BGP route announcer som det går att scripta mot. Se även Cisco BGP.
Installation
pip install exabgp
Konfiguration
Exempel där man kan skicka in väldigt mycket routes till BGP.
Script för att generera prefix: bs-prefixes.py
chmod +x bs-prefixes.py
Script för att annonsera prefix
touch announce.sh && chmod +x announce.sh
announce.sh
#!/bin/sh
# ignore Control C
# if the user ^C exabgp we will get that signal too, ignore it and let exabgp send us a SIGTERM
TEMPFILE=/tmp/prefixes.bgp
PREFIXES=50000
BLOCK=128
trap '' SIGINT
# Dump our prefixs in a file for parsing a block at a time
/path/to/bs-prefixes.py $PREFIXES > $TEMPFILE
# Pause a bit to let BGP sessions come up
sleep 10
LINE=0
while [ $LINE -lt $PREFIXES ]; do
LINE=$(( $LINE + $BLOCK ))
for pfx in `head -n $LINE $TEMPFILE | tail -n $BLOCK`; do
echo "announce route $pfx next-hop 10.0.0.0"
done
sleep 2
done
Konfigurationsfil för exaBGP, edit exabgp.conf
neighbor 10.0.0.11 { description "R2"; router-id 66.66.66.66; local-address 10.0.0.10; local-as 666; peer-as 101; hold-time 600; graceful-restart; # advertise prefixes process service-1 { run /path/to/announce.sh; }
Kör
exabgp exabgp.conf