1

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:

  1. Installed dnsmasq
apt install dnsmasq
  1. 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
  1. 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
  1. made sure to run dnsmasq and reloaded
systemctl disable systemd-resolved
systemctl stop systemd-resolved
systemctl start dnsmasq
systemctl reload NetworkManager
  1. 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         
  1. 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.

  • Try this https://askubuntu.com/questions/1029882/how-can-i-set-up-local-wildcard-127-0-0-1-domain-resolution-on-18-04-20-04 – Pawel Cioch Dec 16 '22 at 02:51

1 Answers1

0

Try putting this as the top line in the resolv.conf:

nameserver 127.0.0.1

And also try installing named.

Eliah Kagan
  • 117,780