Local Host Name Resolving Under Windows With Mikrotik’s DNS

As I switched all DNS resolving to my Mikrotik router, a curious problem appeared. I couldn't access my main file server using its short name anymore.

That is fine, I thought. If I go to IP -> DNS and I add Static entry for it. And so I did and everything worked when I tested it. From Linux machine. From Windows 10 machine you ask? Nope - I couldn't access it still. I try ping and it complains. I try nslookup and it works. Interestingly, an entry with a domain (e.g. server.thing) would work with both. It was just short names that wouldn't behave.

To make long story short, fix is to force Windows to use longer names even for single word lookups. To do this, we can employ magic of DHCP's domain-name setting conveniently available under DHCP network setup. If this is provided to Windows host upon IP address assignment, it will append all single word host names with that DNS suffix and, provided you defined static DNS host entry with that full name, Windows will work happily ever after.

Downside of this solution is that you need to have both long and short form (e.g. server and server.network) defined for mixed Windows/Linux environments. Yes, you can create a regex to cover both but it will look ugly (e.g. ^server(.network)?$). I personally simply define host two times - looks nicer. ;)

Root issue is just another leftover from NBNS/WINS resolver era - something nobody uses on any normal network but somehow Windows still thinks of it as an appropriate default behavior. Annoyingly some components are built smarter so, depending which tool you use, you can chase damn Schrödinger's cat all day long...

4 thoughts to “Local Host Name Resolving Under Windows With Mikrotik’s DNS”

  1. Yep, upon moving to a MikroTik from a Billion router, all clients lost LAS access to our NAS via the hostname “data”.

    Having chased this around for 2 weeks, I’ve now set the MikroTik to DHCP server to server up DHCP cleints with a WINS server and put a static entry in my damn WINS server for the NAS name->IP.

    This resolved my issue, but it blows my mind that in this day and age I’m still running a WINS server to get my Win10 clients to resolve a local device IP from hostname, and that there is no way for me to achieve this within the MikroTik.

    This is because the DNS Static Entry feature in the MikroTik doesn’t work with Win10 clients with the shortname as described above (i.e. “server”, it requires a “server.domain” format.

  2. I fixed this issue by making my domain: WORKGROUP

    This allowed all windows computer to resolve the ip via the hostname

Leave a Reply

Your email address will not be published. Required fields are marked *