Add bird2 + skeleton config

This commit is contained in:
Pim van Pelt
2025-05-04 10:49:55 +02:00
parent e0f336df88
commit 47eed50e30
4 changed files with 39 additions and 1 deletions

View File

@ -4,7 +4,7 @@ ARG VPP_INSTALL_SKIP_SYSCTL=true
ARG REPO=release
EXPOSE 22/tcp
RUN apt-get update && apt-get -y install curl procps tcpdump iproute2 iptables \
iputils-ping net-tools git python3 python3-pip vim-tiny openssh-server && apt-get clean
iputils-ping net-tools git python3 python3-pip vim-tiny openssh-server bird2 && apt-get clean
# Install VPP
RUN mkdir -p /var/log/vpp /root/.ssh/
@ -18,6 +18,7 @@ RUN git clone https://github.com/pimvanpelt/vppcfg.git && cd vppcfg && python3 -
# Config files
COPY files/etc/vpp/* /etc/vpp/
COPY files/etc/bird/* /etc/bird/
COPY files/init-container.sh /sbin/
RUN chmod 755 /sbin/init-container.sh
CMD ["/sbin/init-container.sh"]

View File

@ -0,0 +1 @@
# Containerlab user overrides go in this file.

26
files/etc/bird/bird.conf Normal file
View File

@ -0,0 +1,26 @@
# Bird2 configuration for VPP Containerlab
# router id 192.0.2.0;
timeformat base iso long;
timeformat log iso long;
timeformat protocol iso long;
timeformat route iso long;
log "/var/log/bird/bird.log" { debug, trace, info, remote, warning, error, auth, fatal, bug };
protocol device { scan time 30; }
protocol direct { ipv4; ipv6; check link yes; }
protocol kernel kernel4 {
ipv4 { import none; export where source != RTS_DEVICE; };
learn off; scan time 300;
}
protocol kernel kernel6 {
ipv6 { import none; export where source != RTS_DEVICE; };
learn off; scan time 300;
}
include "bird-local.conf";

View File

@ -3,6 +3,7 @@
STARTUP_CONFIG=${STARTUP_CONFIG:="/etc/vpp/startup.conf"}
CLAB_VPP_FILE=${CLAB_VPP_FILE:=/etc/vpp/clab.vpp}
NETNS=${NETNS:="dataplane"}
BIRD_ENABLED=${BIRD_ENABLED:="true"}
echo "Creating dataplane namespace"
/usr/bin/mkdir -p /etc/netns/$NETNS
@ -14,6 +15,15 @@ sed -i -e 's,^#PermitRootLogin prohibit-password,PermitRootLogin yes,' /etc/ssh/
sed -i -e 's,^root:.*,root:$y$j9T$kG8pyZEVmwLXEtXekQCRK.$9iJxq/bEx5buni1hrC8VmvkDHRy7ZMsw9wYvwrzexID:20211::::::,' /etc/shadow
/etc/init.d/ssh start
if [ "$BIRD_ENABLED" == "true" ]; then
echo "Starting Bird in $NETNS"
mkdir -p /run/bird /var/log/bird
chown bird:bird /var/log/bird
ROUTERID=$(ip -br a show eth0 | awk '{ print $3 }' | cut -f1 -d/)
sed -i -e "s,.*router id .*,router id $ROUTERID; # Set by container-init.sh," /etc/bird/bird.conf
/usr/bin/nsenter --net=/var/run/netns/$NETNS /usr/sbin/bird -u bird -g bird
fi
echo "Generating $CLAB_VPP_FILE"
: > $CLAB_VPP_FILE
MTU=9216