Files
poc-frr-anycast/entrypoints/a-entrypoint.sh
T

23 lines
707 B
Bash
Raw Normal View History

#!/bin/sh
# Runs on a1/a2/a3 before FRR starts:
# - creates the dummy0 anycast interface (zebra only configures IPs on
# interfaces that already exist, it doesn't create them)
# - starts a tiny HTTP responder bound to the anycast IP, returning this
# node's hostname, so traffic-test.sh can show which A-node answered
set -e
ip link add dummy0 type dummy
ip link set dummy0 up
mkdir -p /anycast-web
hostname > /anycast-web/index.html
(
# wait until zebra (per frr.conf) assigns 10.200.200.1 to dummy0
while ! ip -4 addr show dummy0 | grep -q 10.200.200.1; do
sleep 1
done
exec python3 -m http.server 80 --bind 10.200.200.1 --directory /anycast-web
) &
exec /usr/lib/frr/docker-start