Fix VPN DNS resolution in DHCP mode (#1514)

Empty DNS= and FallbackDNS= in resolved.conf were blocking VPN DNS
servers when VPN clients replaced /etc/resolv.conf.

Removing these empty values allows systemd-resolved to:
- Use DHCP DNS from network interfaces (existing behavior)
- Fall back to system defaults when needed
- Switch to 'foreign' mode for VPN DNS override

Fixes #1509
This commit is contained in:
Jarek
2025-09-09 16:24:49 +02:00
committed by GitHub
parent ddef52c192
commit 88c7c4c748
2 changed files with 8 additions and 2 deletions

View File

@@ -37,8 +37,6 @@ EOF
DHCP)
sudo tee /etc/systemd/resolved.conf >/dev/null <<'EOF'
[Resolve]
DNS=
FallbackDNS=
DNSOverTLS=no
EOF

8
migrations/1757361127.sh Normal file
View File

@@ -0,0 +1,8 @@
echo "Fix DHCP DNS to allow VPN DNS override"
if [ -f /etc/systemd/resolved.conf ]; then
if grep -q "^DNS=$" /etc/systemd/resolved.conf && grep -q "^FallbackDNS=$" /etc/systemd/resolved.conf; then
sudo sed -i '/^DNS=$/d; /^FallbackDNS=$/d' /etc/systemd/resolved.conf
sudo systemctl restart systemd-resolved
fi
fi