DoESLiverpool / somebody-should

A place to document practices on the wiki and collect issues/suggestions/to-do items for the physical space at DoES Liverpool
31 stars 11 forks source link

Fix the local DNS/DHCP server caching/leasing #1501

Open MatthewCroughan opened 4 years ago

MatthewCroughan commented 4 years ago

@DoESLiverpool/networking

ping samba.localdomain returns 10.0.37.82 (An IP from 2019) ping samba.local returns 10.0.100.3 (the device IP if an avahi-daemon is running on the client doing the pinging.)

This will not work on Android. This will work on Windows 10 out of the box. It will work on Win7 if bonjour is installed.

If you try to take samba.localdomain with any device, you will not be able to register it. The DNS server on the local network is not allowing anything to take this hostname.

Windows 10 and 7 clients are not able to discover and mount anything via netbios or the more preferred and secure ws-discovery method, due to this issue. On Windows at least, dns lookups that aren't fully qualified go through a list of domains they try, first match wins .localdomain is assigned by DHCP as the local search domain by our gateway 10.0.0.1

The problem seems to be that there is no lease associated with this setting, and that the leases are infinite, which means I we can never register a new device with the same hostname ever again for the lifetime of the network.

A friend from iXSystems remoted into one of our machines and proved this to me by switching the hostname of the samba server from samba -> sambah.

The result of this experiment was that all Windows clients could now discover, connect to and browse the sambah.local shares, since this domain is new and no .localdomain registration exists for it in the local DNS server, allowing Windows to fall back to using mDNS instead.

From aforementioned iXSystems contact:

lease time would be a better way to fix that sambah.localdomain probably isn't registered btw had you used DHCP the entry would have been updated to the new address you didn't use dhcp so it didn't flush out the old dns entry and it didn't register a new one for the new name

If solved, this fixes most if not all of the networking anomalies I and others have conflated in https://github.com/DoESLiverpool/somebody-should/issues/1210

In #1210, @johnmckerrell said this was a setting in the Ubiquiti interface:

Register client hostname from DHCP requests in USG DNS forwarder: ON/OFF Which I found in Settings -> Services -> DHCP -> DHCP Server

I believe this setting is related, since it may be the case that these devices are getting an infinite DHCP Lease

MatthewCroughan commented 4 years ago

TL;DR

The TL;DR of all of this is that the local DNS is not allowing new devices to register previously used hostnames, which causes lots of issues, such as all of the Windows machines not being able to see samba.localdomain, even if they can see mDNS at samba.local, because by default all Win10/Win7/Vista machines use the primary dns suffix supplied by the DHCP server. This is just how the interface is configured on Windows and Android, which don't use mDNS primarily. So it's best to fix this issue than to reconfigure all the clients.

@goatchurchprime You might find this interesting. This rampant issue is caused by 50% of clients not preferring mDNS, but instead preferring the local dhcp provided dns suffix (.localdomain.)

primary dns suffix of cncroom win10 pc is .localdomain (supplied by dhcp)

PS C:\Windows\System32\WindowsPowerShell\v1.0> ipconfig /all

Windows IP Configuration

   Host Name . . . . . . . . . . . . : cncroom
   Primary Dns Suffix  . . . . . . . :
   Node Type . . . . . . . . . . . . : Hybrid
   IP Routing Enabled. . . . . . . . : No
   WINS Proxy Enabled. . . . . . . . : No
   DNS Suffix Search List. . . . . . : localdomain

Ethernet adapter Ethernet:

   Connection-specific DNS Suffix  . : localdomain
   Description . . . . . . . . . . . : Realtek PCIe GBE Family Controller
   Physical Address. . . . . . . . . : 74-D4-35-09-BA-71
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes
   Link-local IPv6 Address . . . . . : fe80::754d:dbf:8d1e:dca3%7(Preferred)
   IPv4 Address. . . . . . . . . . . : 10.0.32.30(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.0.0.0
   Lease Obtained. . . . . . . . . . : 02 October 2020 17:29:14
   Lease Expires . . . . . . . . . . : 06 October 2020 17:29:10
   Default Gateway . . . . . . . . . : 10.0.0.1
   DHCP Server . . . . . . . . . . . : 10.0.0.1
   DHCPv6 IAID . . . . . . . . . . . : 125097013
   DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-23-89-79-48-74-D4-35-09-BA-71
   DNS Servers . . . . . . . . . . . : 10.0.0.1
                                       1.1.1.1
   NetBIOS over Tcpip. . . . . . . . : Enabled
   Connection-specific DNS Suffix Search List :
                                       localdomain
MatthewCroughan commented 4 years ago

As a final note, I tried to register sambah.localdomain and seem to be unable to. So that could explain why we can't override samba.localdomain.