From 2dfdfd358b3de14a12eeabaf6b143e131c62c755 Mon Sep 17 00:00:00 2001 From: sump pump Date: Tue, 28 Apr 2020 04:16:29 +0000 Subject: [PATCH] Initial commit to get Bird working --- bird/bird.conf.tmpl | 22 ++++++++++++++++++++++ build.sh | 9 ++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 bird/bird.conf.tmpl diff --git a/bird/bird.conf.tmpl b/bird/bird.conf.tmpl new file mode 100644 index 0000000..63c684f --- /dev/null +++ b/bird/bird.conf.tmpl @@ -0,0 +1,22 @@ +log stderr all; # Using docker; defer logging to stderr +debug protocols all; # Enable debugging + +router id ${address} + +protocol bgp { + description "Lixonet BGP uplink for ${address} (ASN: {$asn})" + + local as ${asn} + source address ${address} # What local address we use for the TCP connection + path metric 1; # Prefer routes with shorter paths (like Cisco does) +} + +# Define a template to use when connecting to other BGP clients +template bgp lixonet_client { + local as ${asn} +} + +# Neighbor +protocol bgp test from lixonet_client { + neighbor 172.30.0.16 as 4206969016 +} diff --git a/build.sh b/build.sh index 8d17e06..bcdecc3 100644 --- a/build.sh +++ b/build.sh @@ -18,6 +18,13 @@ chmod +x /etc/tinc/lixonet/subnet-up chmod +x /etc/tinc/lixonet/subnet-down # Bird -rm -rf /etc/bird/* +# Remove existing configuration +rm -v -rf /etc/bird/* +# Copy all tinc default files to /etc/(bird) +find bird -type d | xargs -I '{}' mkdir --verbose -p /etc/{} +find bird -type f | xargs -I '{}' cp --verbose {} /etc/{} +# Fill out templates and remove them after +find /etc/bird/ -type f -name '*.tmpl' -exec sh -c 'sigil -f {} -p $(cat /etc/lixonet/lixonet.conf | tr "\\n" " ") > "$(dirname {})/$(basename {} .tmpl)"' {} \; +find /etc/bird/ -type f -name '*.tmpl' | xargs -I '{}' rm -f {} docker-compose up -d --build