18.04 ignoring DHCP-provided DNS server
Solution 1
It turns out the problem was that I didn't have a domain suffix configured in my dnsmasq server.
I added the line:
domain=lan
to /etc/dnsmasq.conf
and restarted the service, and I can now resolve the address for homestar
or homestar.lan
just fine.
Solution 2
I succeeded as follows:
cd /etc/
mv resolv.conf resolv.conf-old
ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf
Related videos on Youtube
marxjohnson
Updated on September 18, 2022Comments
-
marxjohnson over 1 year
I've got a local server (192.168.0.10) running dnsmasq to provide DHCP for my LAN, and a DNS server to resolve hostnames for the DHCP clients.
When I was running 16.04, this worked fine. Any machine getting a DHCP address from the server used the DNS server, and could resolve other hostnames on the network.
However, since upgrading to 18.04, I can't resolve hostnames any more. I understand that 18.04 now uses systemd-resolve. It appears that it's aware of the DNS server:
mark@coachz:~$ systemd-resolve --status Global DNSSEC NTA: 10.in-addr.arpa 16.172.in-addr.arpa 168.192.in-addr.arpa 17.172.in-addr.arpa 18.172.in-addr.arpa 19.172.in-addr.arpa 20.172.in-addr.arpa 21.172.in-addr.arpa 22.172.in-addr.arpa 23.172.in-addr.arpa 24.172.in-addr.arpa 25.172.in-addr.arpa 26.172.in-addr.arpa 27.172.in-addr.arpa 28.172.in-addr.arpa 29.172.in-addr.arpa 30.172.in-addr.arpa 31.172.in-addr.arpa corp d.f.ip6.arpa home internal intranet lan local private test Link 3 (wlp59s0) Current Scopes: DNS LLMNR setting: yes MulticastDNS setting: no DNSSEC setting: no DNSSEC supported: no DNS Servers: 192.168.0.10 Link 2 (enp58s0f1) Current Scopes: none LLMNR setting: yes MulticastDNS setting: no DNSSEC setting: no DNSSEC supported: no
However, it doesn't seem to use it to resolve hostnames:
mark@coachz:~$ nslookup homestar Server: 127.0.0.53 Address: 127.0.0.53#53 ** server can't find homestar: SERVFAIL
Although if I explicitly tell it to, it can:
mark@coachz:~$ nslookup homestar 192.168.0.10 Server: 192.168.0.10 Address: 192.168.0.10#53 Name: homestar Address: 192.168.0.101
How do I get it to use the DHCP-provided DNS server automatically?
-
zwets almost 6 yearsHave you tried
nslookup homestar{.your.domain.here}
?
-
-
damadam over 5 yearshow do you get/create your file
/run/systemd/resolve/resolv.conf
? Please edit your answer to explain this trick -
Laurence Gonsalves over 5 yearsI'm having exactly the same problem, but this solution isn't working for me. I added
domain=lan
in the/etc/dnsmasq.conf
on my dnsmasq server, andservice dnsmasq restart
, but local names still don't resolve. In fact,dig @$MY_DNS_IP $HOSTNAME_ON_MY_LAN.lan
also fails, even thoughdig @$MY_DNS_IP $HOSTNAME_ON_MY_LAN
works. -
Laurence Gonsalves over 5 yearsIn addition to the
domain=lan
line, I also needed to add anexpand-hosts
line to/etc/dnsmasq.conf
. Finally, I needed to set the domain on my DHCP server (my router) so that it would be added to the search path inresolv.conf
-
Philippe over 5 yearsThis worked for me! @damadam The file
/run/systemd/resolve/resolv.conf
is created with netplansudo netplan apply
. You can check the current config by usingsystemd-resolve --status
-
Hudson over 5 yearsThis worked for me (although the first line I had to cd to /etc/ first to backup the original file). On inspecting the old /etc/resolv.conf file it had the nameserver set to 127.0.0.53 just like the OP. I'd be interested in anyone could flesh out this answer with some more explanation and reasons for the fix. Such as is it better to create the symbolic link to the systemd resolv.conf file like in this answer, or if just setting the correct value in the original /etc/resolve.conf would have been better? And why?
-
Thomas Carlisle almost 5 yearsIt is amazing -- but sad and unacceptable -- that still in 2019 and Ubuntu 19.04 this is still an issue and this has to be done to get DNS working when DNS is configured to be handed out from DHCP.
-
Skinner927 over 4 yearsFWIW, you'd add the domain line on 18.04 server to
/etc/systemd/resolved.conf