init(): initial commit

This commit is contained in:
ITQ
2026-02-20 23:14:19 +03:00
commit fd8de1052a
36 changed files with 1713 additions and 0 deletions
+40
View File
@@ -0,0 +1,40 @@
#!/bin/sh
set -eux pipefail
# containerlab needs some time to setup links
sleep $CONTAINERLAB_TIMEOUT
if [ "$ROUTER" = "yes" ]; then
echo "Configuring as router..."
ip link add br0 type bridge
ip addr add 192.168.100.1/24 dev br0
ip addr add 172.16.100.1/24 dev br0
ip link set dev br0 up
ip link set eth1 up
ip link set eth2 up
ip link set eth3 up
ip link set eth4 up
ip link set eth1 master br0
ip link set eth2 master br0
ip link set eth3 master br0
ip link set eth4 master br0
echo "Router setup complete"
else
echo "Configuring as host with CIDR=$CIDR and GATEWAY=$GATEWAY"
ip link set eth1 up
ip addr add $CIDR dev eth1
ip route add default via $GATEWAY dev eth1
echo "Host setup complete"
fi
sleep infinity