Ubuntu – DNS/systemd-resolve/dnsmasq/resolvconf problems. Errors in syslog. 18.04

18.04dnsresolvconf

I'm trying to resolve these two repeating errors in /var/log/syslog

nf_conntrack: nf_conntrack: table full, dropping packet

Maximum number of concurrent DNS queries reached (max: 150)

Looking at /etc/resolv.conf

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
# 127.0.0.53 is the systemd-resolved stub resolver.
# run "systemd-resolve --status" to see details about the actual nameservers.

nameserver 127.0.0.1

I know that the nameserver should be 127.0.0.53, from looking at my other 18.04 system. If I manually change (which I know I shouldn't do) 127.0.0.1 to 127.0.0.53, the errors seem to stop in syslog. Of course, a reboot sets this file back to 127.0.0.1.

How do I get resolv.conf to correctly show 127.0.0.53, and survive reboots? Am I barking up the right tree?

Best Answer

First, thanks to @Terrance and @BernardWei for pointing me to information that ultimately helped me resolve this problem. I used parts of their links to formulate my own process to resolve the repeating error messages in syslog.

Looking at /etc/resolv.conf gives a clue. The nameserver is 127.0.0.1, and that is placed there by dnsmasq. In 18.04 it should be 127.0.0.53, placed there by systemd-resolved.

On my system, I did:

ps auxc | grep -i dns
ps auxc | grep -i resolv

And found that both dnsmasq and systemd-resolved were running, and as far as DNS is concerned, they overlap in functionality. There are two possible fixes.

Fix #1:

I uninstalled dnsmasq and dnsmasq-base (probably left over from a system prior to -29), and then restarted systemd-resolved. /etc/resolv.conf now correctly shows that the nameserver is 127.0.0.53.

Fix #2:

If you need BOTH dnsmasq and systemd-resolved running, then edit /etc/systemd/resolved.conf and change:

#DNSStubListener=yes

to:

DNSStubListener=no

and restart systemd-resolved.

Related Question