closely related to How can I set up local wildcard (127.0.0.1) domain resolution on 18.04? . here is what I have done, following the earlier 18.04 instructions on 19.10:
- Installed dnsmasq
apt install dnsmasq
- edited NetworkManager.conf
# head -3 /etc/NetworkManager/NetworkManager.conf
[main]
plugins=ifupdown,keyfile
dns=dnsmasq
(This appears not to work [add dns=dnsmasq later to resolv.conf.)
3.
# sudo ln -sf /var/run/NetworkManager/resolv.conf /etc/resolv.conf
# ls -l /etc/resolv.conf
lrwxrwxrwx 1 root 35 Oct 18 20:59 /etc/resolv.conf -> /var/run/NetworkManager/resolv.conf
- created a few rules
# more /etc/NetworkManager/dnsmasq.d/*
::::::::::::::
/etc/NetworkManager/dnsmasq.d/dnsmasq-localhost.conf
::::::::::::::
address=/localhost.com/127.0.0.1
::::::::::::::
/etc/NetworkManager/dnsmasq.d/dotlocal-wildcard.conf
::::::::::::::
address=/.local/127.0.0.1
::::::::::::::
/etc/NetworkManager/dnsmasq.d/example.com-wildcard.conf
::::::::::::::
address=/.example.com/127.0.0.1
- made sure to run dnsmasq and reloaded
systemctl disable systemd-resolved
systemctl stop systemd-resolved
systemctl start dnsmasq
systemctl reload NetworkManager
- checked who is listening
# sudo netstat -tulpn | grep dns
tcp 0 0 0.0.0.0:53 0.0.0.0:* LISTEN 949/dnsmasq
tcp6 0 0 :::53 :::* LISTEN 949/dnsmasq
udp 0 0 0.0.0.0:53 0.0.0.0:* 949/dnsmasq
udp6 0 0 :::53 :::* 949/dnsmasq
- and observed my failure
# dig example.com +short
93.184.216.34
# dig example.local +short
# host example.local
Host example.local not found: 3(NXDOMAIN)
Problem 1
: should step 3 have not made resolv.conf
somehow acquire a dns=dnsmask
or (nameserver 127.0.0.1
) to query? if I add these by hand into resolve.conf
, I can (sometimes) resolve example.com
and any.example.com
to the desired 127.0.0.1.
Problem 2 : why does even then 'example.local' not resolve, as desired, to 127.0.0.1?
advice appreciated.
PS: What a pity that wildcard matching to 127.0.0.1 is not part of standard resolved, and instead requires dnsmasq.