OpenWrt news, tools, tips and discussion. Related projects, such as DD-WRT, Tomato and OpenSAN, are also on-topic.
DNS resolution of local hostnames, why is the FQDN sometiems necessary?
My local domain is .lan
. I have some devices on the local network that can only resolve other devices' hostnames when using the FQDN, so for example nslookup openwrt.lan
would work but nslookup openwrt
wouldn't. But.. this only happens on certain devices.
For example, my Debian machine can resolve it. Some of the Docker containers it's running can resolve it, but some others can't.. even if their networking mode matches up. My Windows machine can, but my roommate's can't.
I use adguardhome running on a different machine than the router, and that's my DNS server.
What's the reason behind this behavior? Maybe some misconfiguration or just a misunderstanding on my end? I had already realized that it's a better practice to use the FQDN instead, so I will. Just want to understand.
FQDN is always used and always required.
However, most operating systems do a good job hiding that requirement (appending available DNS suffixes to every bare-host query). And if that "magic" fails - you see the issues you've ran into.
Happen to know why that magic fails? (or rather why it sometimes works?)
I have three Windows 11 systems and it works on 2 of them, it works on my Apple TV and my iPhone but not on my work MacBook, it works on my Android tablet but not on my Android phone, and it works on my NAS running DSM as well as the Debian mini PC I have, as well as 4 bridged Network docker containers but not on 3 others lol
Use a Search Domain - DHCP can usually hint the OS to do this, so your host resolve file ends up like
That way, when you lookup
box1
,xyz.lan
is automatically used.For your windows machines, if you do an
ipconfig /all
You should see in the "Windows IP Configuration" section at the top a list of the DNS Suffix Search List, in this should be your "lan" suffix (along with potentially some others based off your DHCP rules).
If this is missing on your roommates PC, then you will need to check the DNS Suffix (as mentioned by Kornerz) is set to "Append primary and connection specific DNS Suffixes", or if it has been set to "Append these DNS suffix in order" for any reason, simply add in "lan" as a suffix and apply and either restart the network connection or reboot the windows device.
This should sort out the windows client.
As to why it works on some, and not others. Could be many things like the particular DHCP client is not listening for the relevant DHCP option to set the suffix (or is just ignoring it)...
I actually checked this yesterday, it isn't missing on any of the devices
If you are running AGH you can see queries made against it in real time. Domain suffixes are applied incrementally, so if you query “openwrt” and there should be a log from the IP asking for “openwrt.”
— Starfox
Matter uses mDNS to improve device discover on local networks, and is part of the simplified device setup. Consequently, if you want to use Matter successfully, your network should have mDNS enabled. For Matter to work as intended, needs to support multiple protocols.