0

I'm having some trouble setting up a DHCP/DNS solution - specifically, getting the clients to use the DNS service provided by the router.

I have an "EdgeRouter" that I have set up as a switch (interface switch0), with a DHCP server, as well as a Dnsmasq service to provide resolution of DHCP hostnames as per this guide

# show service dhcp-server
 disabled false
 hostfile-update disable
 shared-network-name my-dhcp {
     authoritative disable
     subnet 192.168.7.0/24 {
         default-router 192.168.7.1
         dns-server 192.168.7.1
         domain-name local
         lease 86400
         start 192.168.7.100 {
             stop 192.168.7.240
         }
     }
 }
 static-arp disable
 use-dnsmasq enable

I have two clients - an Ubuntu 18.04 linux laptop (call it ubuntu), and a Windows 10 laptop (call it windows), both of which connect to the switch and get an IP address via DHCP. I can fully ping between each client and the switch management interface, and between each other. I've also examined the DHCP records received by each client and verified that they receive a DNS server address of 192.168.7.1, which is correct.

On the switch I can confirm these leases with:

$ cat /var/run/dnsmasq-dhcp.leases
1420222142 ec:8e:b5:94:bd:8f 192.168.7.175 ubuntu *
1420219707 c8:d3:ff:6f:42:15 192.168.7.100 windows 01:c8:d3:ff:6f:42:15

On ubuntu I can also verify that the DNS server on the switch is working correctly:

$ dig @192.168.7.1 ubuntu

; <<>> DiG 9.11.3-1ubuntu1.13-Ubuntu <<>> @192.168.7.1 ubuntu
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 15747
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;ubuntu.            IN  A

;; ANSWER SECTION:
ubuntu.     43200   IN  A   192.168.7.175

;; Query time: 0 msec
;; SERVER: 192.168.7.1#53(192.168.7.1)
;; WHEN: Tue Nov 03 12:21:15 NZDT 2020
;; MSG SIZE  rcvd: 53

Similar response for a dig with windows.

If I ssh into the router I can ping ubuntu or ping windows with no problem - the name resolves.

The problem is that neither the Linux nor Windows laptop seem to resolve when I ping from Windows:

> ping ubuntu
Ping request could not find host ubuntu. Please check the name and try again.

Or from Linux:

$ ping windows
ping: windows: Name or service not known

Also from the Linux client:

$ nslookup windows
Server:     127.0.0.53
Address:    127.0.0.53#53

** server can't find windows: SERVFAIL

From what I understand, my Linux laptop is running its own dnsmasq and /etc/resolv.conf looks like this:

nameserver 127.0.0.53
options edns0
search local

I'm not sure how to check the dnsmasq status to see if it's forwarding to/from the DNS server address that DHCP obtained.

On the Windows side I have no idea how to debug this.

Also, bizarrely, just after writing this, the Linux side of things suddenly started working:

$ nslookup windows
Server:     127.0.0.53
Address:    127.0.0.53#53

Non-authoritative answer:
Name:   windows.local
Address: 192.168.7.100

I didn't change anything! Maybe something figured itself out over a period of 10-20 minutes. But the Windows side is not working.

What would be the best next step for figuring this out?

7
  • Showing my ignorance of Windows networking here - apparently ping ubuntu.local works from Windows. Seems that if I set the connection's DNS suffix to local then ping ubuntu starts working. So maybe it's all working after all? But then my Linux client just decided to have nslookup report ** server can't find windows.local: NXDOMAIN - but then I ran it again immediately and it was OK. Sigh.
    – davidA
    Commented Nov 2, 2020 at 23:43
  • Additional question - should I even configure the router for local as system domain name if I don't actually need one? What if I removed domain-name local from the dhcp server config? Would that make things more or less complex?
    – davidA
    Commented Nov 2, 2020 at 23:44
  • Yes, your Dnsmasq should have some domain name because a few tools will refuse to resolve single-label names via DNS. However, I would highly recommend using some other domain name and checking if the problem still occurs with that. Do not use local as your LAN domain. Even a made-up suffix like lan or private is less bad; though I would personally prefer home.arpa since it's officially designated for this purpose. Commented Nov 3, 2020 at 5:36
  • And it just occurs to me that the domain name advertised by DHCP actually has to match the name configured in Dnsmasq as the first thing. Can you check whether EdgeRouter adds the correct configuration? Commented Nov 3, 2020 at 5:42
  • @user1686 thank you for your advice. I am now using a different LAN domain name: lan. I also checked that changing the DHCP Domain in the UI adjusts the dnsmasq config, and it seems to do so - the relevant names in /etc/dnsmasq.d/dnsmasq-dhcp-config.conf are adjusted automatically. Is that sufficient for the check you propose? Interestingly the old local name is also retained: domain=lan,192.168.7.0/24,local
    – davidA
    Commented Nov 4, 2020 at 21:05

0

You must log in to answer this question.

Browse other questions tagged .