diff --git a/nspawn-container/scripts/10-setup-network.sh b/nspawn-container/scripts/10-setup-network.sh index f21b50d0..01a42a8c 100644 --- a/nspawn-container/scripts/10-setup-network.sh +++ b/nspawn-container/scripts/10-setup-network.sh @@ -58,9 +58,18 @@ if [ -n "${IPV6_IP}" ]; then 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)" +# Dnsmasq is now started with --conf-dir=/run/dnsmasq.dhcp.conf.d/ so we can drop +# our own config files into that directory, even if they aren't related to DHCP. +if [ -d /run/dnsmasq.dhcp.conf.d ]; then + # unifi network > 9.3.29 + echo "interface=br${VLAN}.mac" > /run/dnsmasq.dhcp.conf.d/macvlan.conf + kill -9 "$(cat /run/dnsmasq-main.pid)" +else + # older versions + 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 fi # (optional) IPv4 force DNS (TCP/UDP 53) through DNS container @@ -81,4 +90,4 @@ for intfc in ${FORCED_INTFC}; do fi done fi -done \ No newline at end of file +done