Skip to content

Commit 6038793

Browse files
committed
Add more resolv checks and fixes
1 parent ca88eea commit 6038793

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

ext/standard/tests/dns/resolv-setup.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,35 @@ systemctl is-active systemd-networkd || echo "systemd-networkd disabled"
2626
# Check what's managing your interface
2727
networkctl status $IFACE
2828

29+
# Check network configs
30+
echo "Checking 10-netplan-eth0.network"
31+
if [ -f /run/systemd/network/10-netplan-eth0.network ]; then
32+
# Check if UseDNS is already configured
33+
if ! grep -q "UseDNS=" /run/systemd/network/10-netplan-eth0.network; then
34+
echo "Adding UseDNS=false to DHCP section"
35+
36+
# Use sed to add UseDNS=false after the [DHCP] section header
37+
sed -i '/^\[DHCP\]/a UseDNS=false' /run/systemd/network/10-netplan-eth0.network
38+
39+
echo "Updated configuration:"
40+
cat /run/systemd/network/10-netplan-eth0.network
41+
42+
# Restart systemd-networkd
43+
systemctl restart systemd-networkd
44+
sleep 2
45+
else
46+
echo "UseDNS already configured in the file"
47+
grep "UseDNS" /run/systemd/network/10-netplan-eth0.network
48+
fi
49+
cat /run/systemd/network/10-netplan-eth0.network
50+
elif [ -d /run/systemd/network/ ]; then
51+
echo "ls -la /run/systemd/network/"
52+
ls -la /run/systemd/network/
53+
else
54+
echo "ls -la /run/systemd/"
55+
ls -la /run/systemd/
56+
fi
57+
2958
# Get current DNS server
3059
echo "Current configuration:"
3160
resolvectl status "$IFACE" | grep -E 'Current DNS Server:|DNS Servers:'

0 commit comments

Comments
 (0)