Consolidate FRR+Bird+VPP into /config for bind-mounting; Move to multitool for the linux client, it has SSH

This commit is contained in:
2026-04-01 22:39:08 +02:00
parent ad72dae812
commit 039d09d358
9 changed files with 32 additions and 15 deletions

View File

@@ -42,11 +42,13 @@ RUN curl -s -o /usr/share/keyrings/frrouting.gpg https://deb.frrouting.org/frr/k
# Install Bird2
RUN curl -s -o /usr/share/keyrings/cznic-labs-pkg.gpg https://pkg.labs.nic.cz/gpg && \
echo "deb [signed-by=/usr/share/keyrings/cznic-labs-pkg.gpg] https://pkg.labs.nic.cz/bird2 noble main" \
> /etc/apt/sources.list.d/cznic-labs-bird2.list && \
> /etc/apt/sources.list.d/cznic-labs-bird2.list && \
apt -y update && apt -y install bird2 && apt clean
# Config files
COPY files/etc/ /etc/
RUN mkdir /config \
&& for i in vpp bird frr; do mv /etc/$i /config/$i; ln -sf /config/$i /etc/$i; done
COPY files/init-container.sh /sbin/
RUN chmod 755 /sbin/init-container.sh
CMD ["/sbin/init-container.sh"]

View File

@@ -1,2 +1,12 @@
exec /etc/vpp/clab.vpp
exec /etc/vpp/vppcfg.vpp
mpls table add 0
set ip neighbor-config ip4 age 900
set ip neighbor-config ip6 age 900
lcp lcp-auto-subint off
lcp lcp-sync on
lcp lcp-sync-unnumbered on
lcp param del-static-on-link-down on
lcp param del-dynamic-on-link-down on
exec /etc/vpp/config/manual-pre.vpp
exec /etc/vpp/config/clab.vpp
exec /etc/vpp/config/vppcfg.vpp
exec /etc/vpp/config/manual-post.vpp

View File

@@ -0,0 +1 @@
comment { You can add commands here that will execute after vppcfg.vpp }

View File

@@ -0,0 +1 @@
comment { You can add commands here that will execute before clab.vpp }

View File

@@ -0,0 +1 @@
comment { This file will be overwritten / generated by containerlab upon deploy }

View File

@@ -1,8 +1,9 @@
#!/usr/bin/env bash
STARTUP_CONFIG=${STARTUP_CONFIG:="/etc/vpp/startup.conf"}
CLAB_VPP_FILE=${CLAB_VPP_FILE:=/etc/vpp/clab.vpp}
VPPCFG_VPP_FILE=${VPPCFG_VPP_FILE:=/etc/vpp/vppcfg.vpp}
STARTUP_CONFIG=${STARTUP_CONFIG:="/config/vpp/startup.conf"}
VPPCFG_YAML_FILE=${VPPCFG_YAML_FILE:=/config/vpp/vppcfg.yaml}
VPPCFG_VPP_FILE=${VPPCFG_VPP_FILE:=/config/vpp/config/vppcfg.vpp}
CLAB_VPP_FILE=${CLAB_VPP_FILE:=/config/vpp/config/clab.vpp}
NETNS=${NETNS:="dataplane"}
BIRD_ENABLED=${BIRD_ENABLED:="true"}
FRR_ENABLED=${FRR_ENABLED:="false"}
@@ -11,6 +12,7 @@ echo "Creating dataplane namespace"
/usr/bin/mkdir -p /etc/netns/$NETNS
/usr/bin/touch /etc/netns/$NETNS/resolv.conf
/usr/sbin/ip netns add $NETNS
/usr/bin/nsenter --net=/run/netns/$NETNS /usr/sbin/ip link set lo up
echo "Starting SSH, with credentials root:vpp"
sed -i -e 's,^#PermitRootLogin prohibit-password,PermitRootLogin yes,' /etc/ssh/sshd_config
@@ -22,14 +24,14 @@ if [ "$BIRD_ENABLED" == "true" ]; then
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
sed -i -e "s,.*router id .*,router id $ROUTERID; # Set by container-init.sh," /config/bird/bird.conf
/usr/bin/nsenter --net=/run/netns/$NETNS /usr/sbin/bird -u bird -g vpp -c /config/bird/bird.conf
fi
if [ "$FRR_ENABLED" == "true" ]; then
echo "Starting FRRouting in $NETNS"
ROUTERID=$(ip -br a show eth0 | awk '{ print $3 }' | cut -f1 -d/)
sed -i -e "s,^ip router-id .*,ip router-id $ROUTERID," /etc/frr/frr.conf
sed -i -e "s,^ip router-id .*,ip router-id $ROUTERID," /config/frr/frr.conf
/etc/init.d/frr start
fi
@@ -49,10 +51,10 @@ set interface state $IFNAME up
EOF
done
echo "Generating $VPPCFG_VPP_FILE"
echo "Generating $VPPCFG_YAML_FILE into $VPPCFG_VPP_FILE"
: > $VPPCFG_VPP_FILE
if [ -r /etc/vpp/vppcfg.yaml ]; then
vppcfg plan --novpp -c /etc/vpp/vppcfg.yaml -o $VPPCFG_VPP_FILE
if [ -r $VPPCFG_YAML_FILE ]; then
vppcfg plan --novpp -c $VPPCFG_YAML_FILE -o $VPPCFG_VPP_FILE
fi
echo "Starting VPP"