File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed
Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,35 @@ systemctl is-active systemd-networkd || echo "systemd-networkd disabled"
2626# Check what's managing your interface
2727networkctl 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
3059echo " Current configuration:"
3160resolvectl status " $IFACE " | grep -E ' Current DNS Server:|DNS Servers:'
You can’t perform that action at this time.
0 commit comments