I'm running into a strange issue. For the record, I'm using Ubuntu 17.10.
I'm trying to configure a custom TLD, call it .mytld, to resolve to 127.0.0.1 so I can host local websites without needing to update
On this machine, network interfaces are managed by NetworkManager, which does not have a line
dns=dnsmasq in the
[main] section of
I installed dnsmasq and confirmed it is running.
/etc/dnsmasq.conf and added:
/etc/dnsmasq.d/mytld.conf and added:
And I edited
/etc/dhcp/dhclient.conf and added:
prepend domain-name-servers 127.0.0.1;
dnsmasq and manually executing
dhclient, I confirmed that
127.0.0.1 was prepended as a DNS server (10.0.0.1 is my gateway machine):
$ nmcli [ ... ] DNS configuration: servers: 127.0.0.1 10.0.0.1 [snip]
Because NetworkManager is managing the network,
/etc/resolv.conf contains the NM stub server:
$ cat /etc/resolv.conf # This file is managed by man:systemd-resolved(8). Do not edit. # # 127.0.0.53 is the systemd-resolved stub resolver. # run "systemd-resolve --status" to see details about the actual nameservers. nameserver 127.0.0.53 $ systemd-resolve --status [...] Link 2 (eno1) [...] DNS Servers: 127.0.0.1 10.0.0.1 [snip]
After all that, when I ping an arbitrary host.mytld, I get a good response:
$ ping -c 1 test.mytld PING test.mytld (127.0.0.1) 56(84) bytes of data. 64 bytes of data from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.026 ms [ snip ] $ dig A test.mytld [ ... ] ;; ANSWER SECTION: test.mytld. 0 IN A 127.0.0.1 ;; Query time: 0 msec ;; SERVER: 127.0.0.53#53(127.0.0.53) [snip]
So, it works -- for a little while.
After a few minutes of normal operation, things start to go south.
systemd-resolved gets pegged at 100% CPU, and
dnsmasq hovers at about 50% CPU. (I have a 6-core, 12-thread CPU.)
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 20659 systemd+ 20 0 66368 6448 5272 R 98.7 0.0 27:31.57 systemd-resolve 13834 dnsmasq 20 0 64516 2840 2424 R 59.3 0.0 35:50.65 dnsmasq
While this is going on,
*.mytld still resolves to 127.0.0.1. Then, after a while (can take dozens of minutes), whatever is happening with
dnsmasq resolves itself -- both processes are still running, with the same PIDs.
But the response given by NetworkManager no longer works:
$ ping -c 1 test.mytld PING test.mytld (188.8.131.52) 56(84) bytes of data. --- test.mytld ping statistics --- 1 packets transmitted, 0 received, 100% packet loss, time 0ms $ dig A test.mytld ;; ANSWER SECTION: test.mytld. 10 IN A 184.108.40.206 test.mytld. 10 IN A 220.127.116.11 ;; Query time: 31 msec ;; SERVER: 127.0.0.53#53(127.0.0.53)
Yet, weirdly, both
systemd-resolve --status still report the nameservers as
10.0.0.1, in that order.
At this point, I have to re-run
dhclient to get things working again:
$ sudo dhclient RTNETLINK answers: File exists $ ping -c 1 test.mytld PING test.mytld (127.0.0.1) 56(84) bytes of data. 64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.129 ms --- test.mytld ping statistics --- 1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 0.129/0.129/0.129/0.000 ms
And then the cycle repeats: after a while,
dnsmasq start wigging out; then they recover, but the resolution fails.