Comment 11 for bug 1980146

Revision history for this message
mixmastamyk (ubforums) wrote : Re: dnsmasq often using 100% of CPU

Spent the whole morning on it and finally figured it out—I had dnsmasq looking
at the wrong DNS server because it was looking at the wrong resolv.conf:

    ⏵ cat /var/run/NetworkManager/resolv.conf
    # Generated by NetworkManager
    nameserver 127.0.0.53

I remember now that early on there were too many daemons managing DNS !!
(NetworkManager, systemd-resolved, dnsmasq). Couldn't get them all happy so I
removed systemd-resolved.

That would be fine if there was something running at 127.0.0.53 but there
wasn't since I'd uninstalled it.
I needed the original (though dynamic) resolv.conf and found it at
no-stub-resolv.conf:

    ⏵ head /etc/dnsmasq.d/foo.conf

    address=/#/127.0.0.2
    port=53
    # resolv-file=/var/run/NetworkManager/resolv.conf
    resolv-file=/var/run/NetworkManager/no-stub-resolv.conf

This file has my correct DNS info from the router and now dnsmasq is working
quietly as expected. I see there are other ways to configure things
(NetworkManager can run dnsmasq too!) but I like this way because I can do
everything in just one file. No need to instruct NetworkManager to write
/etc/resolv.conf either.

Was inclined to close this, but thinking about it, dnsmasq should not hammer a
non-existent DNS server to the point of saturating the CPU.

True, the server address was misconfigured but dnsmasq should check *at most* once every few seconds. Definitely needs a delay in there in this case.