NetworkManager writing to resolv.conf every reboot, breaking dnsmasq?
Same problem with dnsmasq:
- Edit
/etc/NetworkManager/NetworkManager.conf
and after[Main]
add or change todns=none
. Save the file. - Execute
systemctl restart NetworkManager.service
(please note uppercase and lowercase). - Edit
/etc/resolv.conf
with your values. Save the file.
Optional testing: reboot and confirm.
Hope be useful, thanks for your attention.
Related videos on Youtube
sphere
Updated on September 18, 2022Comments
-
sphere over 1 year
I am on Ubuntu 18.04 using the
netplan
configuration which renders usingNetworkManager
:# Let NetworkManager manage all devices on this system network: version: 2 renderer: NetworkManager
Every time I restart, the following output is automatically generated and written to
/etc/resolv.conf
, breaking mydnsmasq
configuration in that I can no longer resolve domains on the internet:# Generated by NetworkManager nameserver 127.0.0.53
I can fix this manually by simply commenting out the nameserver line in /etc/resolv.conf. Before I write a script to perform this commenting out every reboot, I should understand what's going on.
This is my simple
/etc/dnsmasq.conf
:port=53 domain-needed bogus-priv strict-order server=/mydomain.net/10.0.0.2 server=/#/8.8.8.8 listen-address=127.0.0.1 bind-interfaces
1) Why is this being written by
NetworkManager
every reboot?2) Why is it breaking
dnsmasq
anyway because the strict-order server settings should forward all other requests to google's DNS server? Whendnsmasq
is running, does the system look in resolv.conf first or after dnsmasq.conf?-
Boris Hamanov about 5 yearsThe problem is due to a couple of problems. Understand that DNS in 18.xx is kinda screwball. Edit your question with the output from
ls -al /etc/resolv.conf
andps auxc | grep dns
andps auxc | grep resolv
andcat /run/resolvconf/resolv.conf
andcat /run/systemd/resolve/resolv.conf
. Are you using dnsmasq for DNS, or DHCP? Did you install it, or did it come over from an upgrade? -
sphere about 5 yearsI totally don't understand what's going on - why does
dnsmasq
only work when the contents of/etc/resolv.conf
are empty ifsystemd-resolvd
is disabled? -
Boris Hamanov about 5 yearsIf you respond to my earlier comment, I'll have some info to go on. Also show me
cat /etc/NetworkManager/NetworkManager.conf
.
-
-
MBulava almost 5 yearsOMG thatnks a ton! NetworkManager and dnsmasq have been a thorn in my side for the last week