Following How to disable systemd-resolved and resolve DNS with dnsmasq?
However, I followed it as much as I could, but still wasn't able to properly replace systemd-resolved with dnsmasq --
If i put dns=dnsmasq under [main] in /etc/NetworkManager/NetworkManager.conf, then the nameserver in my /etc/resolv.conf will be my ISP's, not my dnsmasq. If removing it, then the nameserver in my /etc/resolv.conf will remain to be systemd-resolved's, i.e., 127.0.0.53
So all in all, how to properly use dnsmasq as system DNS service?
- I've removed
resolvconf, and now the question is, - how to replace systemd-resolved with dnsmasq?
PS.
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.1 LTS
Release: 18.04
Codename: bionic
UPDATE:
I've actually tried two times, with the latest attempt from a fresh Lubuntu 18.04.2 LTS installation, and both cases did not work. By "did not work" I meant I can see dnsmasq is listening on ':53' via netstat, but dig cnn.com and/or any DNS query times out.
Here is the updated info. Note that I've reverted my changes and am now back to using systemd-resolved. So results like grep -i stub /etc/systemd/resolved.conf reflect my current stage (back to systemd-resolved).
$ dpkg -l '*dnsmasq*'
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-===================-==============-==============-===========================================
ii dnsmasq 2.79-1 all Small caching DNS proxy and DHCP/TFTP serve
ii dnsmasq-base 2.79-1 amd64 Small caching DNS proxy and DHCP/TFTP serve
un dnsmasq-base-lua <none> <none> (no description available)
ii dnsmasq-utils 2.79-1 amd64 Utilities for manipulating DHCP leases
$ ls -al /etc/resolv.conf
lrwxrwxrwx 1 root root 35 2019-07-14 22:07 /etc/resolv.conf -> /var/run/NetworkManager/resolv.conf
$ grep -i stub /etc/systemd/resolved.conf
#DNSStubListener=yes
$ cat /etc/NetworkManager/NetworkManager.conf
[main]
plugins=ifupdown,keyfile
[ifupdown]
managed=false
[device]
wifi.scan-rand-mac-address=no
I've removed resolvconf:
$ dpkg -l 'resolvconf'
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-===================-==============-==============-===========================================
un resolvconf <none> <none> (no description available)
$ sudo ls /run/resolvconf/resolv.conf
ls: cannot access '/run/resolvconf/resolv.conf': No such file or directory
UPDATE2:
I now think I know what went wrong -- after the change (following all the steps in the answer), I checked the content of /etc/resolv.conf, and found its content remains the same. I.e., still having nameserver 127.0.0.53.
Now I recall that nameserver 127.0.0.53 is for systemd-resolved, whereas for dnsmasq, it should be nameserver 127.0.0.1. That's why all DNS queries are timing out.
I.e., there is one step missing from the answer, which is to change nameserver to 127.0.0.1 in /etc/resolv.conf, which I don't know how.