/etc/resolv.conf pointing to dnsmasq instead of resolved

Bug #1729194 reported by Christopher
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
network-manager (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Systemd sometimes just doesn't resolve DNS queries and for the life of me I don't know why.

So often when I'm switching between wifi networks I find that systemd-resolved in 17.10 complete fails to do it's job. Here's the example. I'm connected to the internet :

```
chalbersma@nebraska [~] {Tue Oct 31 20:58:18}
> ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=53 time=196 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=53 time=67.5 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=53 time=78.9 ms
^C
--- 8.8.8.8 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 1999ms
rtt min/avg/max/mdev = 67.534/114.169/196.025/58.068 ms
```

But I can't seem to resolve domains:

```
chalbersma@nebraska [~] {Tue Oct 31 20:59:17}
> nslookup google.com
;; connection timed out; no servers could be reached

```

So I did a `systemd-resolver --status` to see if it's getting the right dns server. It is :

```
Link 3 (wlp2s0)
      Current Scopes: DNS LLMNR/IPv4 LLMNR/IPv6
       LLMNR setting: yes
MulticastDNS setting: no
      DNSSEC setting: no
    DNSSEC supported: no
         DNS Servers: 192.168.43.1
                      2001:4888:51:ff00:506:d::
                      2001:4888:50:ff00:500:d::

```

And it's actually up and working properly :

```
chalbersma@nebraska [~] {Tue Oct 31 21:02:06}
> nslookup google.com 192.168.43.1
Server: 192.168.43.1
Address: 192.168.43.1#53

Non-authoritative answer:
Name: google.com
Address: 172.217.11.78
chalbersma@nebraska [~] {Tue Oct 31 21:03:16}
> nslookup google.com 2001:4888:51:ff00:506:d::
Server: 2001:4888:51:ff00:506:d::
Address: 2001:4888:51:ff00:506:d::#53

Non-authoritative answer:
Name: google.com
Address: 172.217.11.78
```

Systemd just can't figure out to make the request. I did try the common step of flushing the cache (with `--flush-cache`) restarting network-manager and systemd-resolverd service but nothing seems to be able to make systemd-resolverd function. Even a reboot doesn't always fix the issue; sometimes it persists.

For debugging this is what's in my /etc/resolv.conf :

```
chalbersma@nebraska [~] {Tue Oct 31 21:09:15}
> cat /etc/resolv.conf
# Generated by NetworkManager
nameserver 127.0.1.1
```

As soon as I manually set the nameserver from my loopback to the actual dns server (bypassing systemd-resolvd) things start working again. Let me know what kind of tshooting data I'd need to grab to help display this issue.

In order to restore networking I had to manually edit that file and change my dns to the external source.

information type: Public → Public Security
information type: Public Security → Public
Revision history for this message
Christopher (chalbersma-12) wrote :

Some more troubleshooting, I've found that if I manually set my nameserver to 127.0.0.53 systemd-resolver starts working again. However everytime that a wifi network connects or disconnects, it switches back to `127.0.0.1`

It does look like systemd-resolve only listens on that port too. :

`udp 0 0 127.0.0.53:53 0.0.0.0:* 858/systemd-resolve`

So what I need to find out is why network-manager isn't using the right settings for systemd-resolve.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in systemd (Ubuntu):
status: New → Confirmed
Revision history for this message
Steve Langasek (vorlon) wrote :

127.0.1.1 is not the address of systemd-resolved, as you noted; it's the address used by dnsmasq. It sounds like your network-manager config is pointing to dnsmasq, which is no longer the default in 17.10, and should have been dropped from your config on upgrade from 16.10 to 17.04. Can you please attach the /etc/NetworkManager/NetworkManager.conf from the affected system?

affects: systemd (Ubuntu) → network-manager (Ubuntu)
summary: - Systemd-Resolvd Forgets to Resolv Request
+ /etc/resolv.conf pointing to dnsmasq instead of resolved
Revision history for this message
Christopher (chalbersma-12) wrote :

Here's the configuration :

```
[main]
plugins=ifupdown,keyfile

[ifupdown]
managed=false

[device]
wifi.scan-rand-mac-address=no
```

There's not anything about dnsmasq there is an empty directory /etc/NetworkManager/dnsmasq.d with nothing configured in it though.

Revision history for this message
Pieter (diepes) wrote :

Fixed my dnsmasq systemd-resolve race with dnsmasq config.

/etc/dnsmasq.d/myconfig
#PES 20180808 dnsmasq and systemd-resolve conflict.
# dont use /etc/resolv.conf, go direct to systemd-resolve, only bind to lo
no-resolv
bind-interfaces
interface=lo
server=127.0.0.53

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.