1

I am trying to set up dnsmasq as an address resolver on an Ubuntu 18.10.

So far I disabled systemd-resolved as the default resolver and brought dnsmasq in. Running netstat -tulpn shows the following:

> sudo netstat -tulpn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:53              0.0.0.0:*               LISTEN      31609/dnsmasq       
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      561/sshd            
tcp        0      0 0.0.0.0:443             0.0.0.0:*               LISTEN      4614/openvpn        
tcp6       0      0 :::53                   :::*                    LISTEN      31609/dnsmasq       
tcp6       0      0 :::22                   :::*                    LISTEN      561/sshd            
udp        0      0 0.0.0.0:53              0.0.0.0:*                           31609/dnsmasq       
udp        0      0 XXX.XXX.XX.XX:YY        0.0.0.0:*                           440/systemd-network 
udp6       0      0 :::53                   :::*                                31609/dnsmasq

I think this is fine so far, as now dnsmasq is listening on port 53.

My /etc/resolv.conf looks like this:

nameserver 127.0.0.1
nameserver 127.0.1.1
nameserver 127.0.0.53

I am not sure about the second line, but I think this should be fine so far, too.

Nevertheless, when I try to run dig, ping or whatever, the connection always times out:

> dig askubuntu.com

; <<>> DiG 9.11.4-3ubuntu5-Ubuntu <<>> askubuntu.com
;; global options: +cmd
;; connection timed out; no servers could be reached

Where did I do something wrong, so I broke those functions?

flomei
  • 113

1 Answers1

2

systemd-resolved is still running, as I see 127.0.0.53 in your /etc/resolv.conf.

If dnsmasq was running, it would show 127.0.0.1.

When you run both together, they tend to step on each others toes.

To run dnsmsaq, and to disable the DNS functionality of systemd-resolved, you need to edit /etc/systemd/resolved.conf and...

change:

#DNSStubListener=yes

to:

DNSStubListener=no

then reboot, recheck /etc/resolv.conf and you should see 127.0.0.1.

postnote: do NOT manually edit /etc/resolv.conf.

heynnema
  • 73,649