From e935c3fd9d6abcffbbdbdc234632598da7678687 Mon Sep 17 00:00:00 2001 From: sofakng Date: Sun, 11 Jun 2023 03:42:22 -0400 Subject: [PATCH] Update 10-setup-network.sh to allow DNSmasq to listen to container network (#550) --- nspawn-container/scripts/10-setup-network.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/nspawn-container/scripts/10-setup-network.sh b/nspawn-container/scripts/10-setup-network.sh index c3e375d..4d4b82b 100644 --- a/nspawn-container/scripts/10-setup-network.sh +++ b/nspawn-container/scripts/10-setup-network.sh @@ -50,3 +50,9 @@ ip route add "${IPV4_IP}/32" dev "br${VLAN}.mac" if [ -n "${IPV6_IP}" ]; then ip -6 route add "${IPV6_IP}/128" dev "br${VLAN}.mac" fi + +# Make DNSMasq listen to the container network for split horizon or conditional forwarding +if ! grep -qxF "interface=br${VLAN}.mac" /run/dnsmasq.conf.d/custom.conf; then + echo "interface=br${VLAN}.mac" >>/run/dnsmasq.conf.d/custom.conf + kill -9 "$(cat /run/dnsmasq.pid)" +fi