Work around windows automatically appending DNS suffix

dnsmasqdomain-name-systeminternal-dnswindows 7

At my workplace, our IT department manages a DNS server. My department works a lot with websites and to access staging servers we need to have certain domains map to those servers. Personally I just edit my hosts file, but our team is somewhat large and I can't go to every machine and edit their hosts file every single time.

So my solution is to have a simple DNS forwarding server. I want to use dnsmasq. I'll refer to the companies DNS domain as company.com and the domain I want to use for our local DNS as mydomain.com

Currently I have the DNS server running, and I'm using argonath as a subdomain of mydomain.com. There are two machine connected at the moment, one is a windows box called pc115 and the other is a linux workstation called mithrandir. My "sub dns" forwards any queries it can't answer to company.com's DNS, and that works nicely. The Linux workstation is working correctly (so for example, ping pc115 works).

However on the windows machine, I'm having trouble doing ping mithrandir. What it looks like is happening, is Windows automatically tacks on company.com to any queries. So my DNS gets mithrandir.company.com which it knows nothing about, and forwards that to the bigger DNS. Here's the relevant part of the dnsmasq logfile (172.17.14.19 is the company's DNS and 10.10.31.15 is mine):

May 12 15:07:52 dnsmasq[11970]: query[A] mithrandir.company.com from 10.10.31.15
May 12 15:07:52 dnsmasq[11970]: forwarded mithrandir.company.com to 172.17.14.19
May 12 15:07:52 dnsmasq[11970]: reply mithrandir.company.com is NXDOMAIN-IPv4
May 12 15:07:52 dnsmasq[11970]: query[AAAA] mithrandir.company.com from 10.10.31.15
May 12 15:07:52 dnsmasq[11970]: forwarded mithrandir.company.com to 172.17.14.19
May 12 15:07:52 dnsmasq[11970]: reply mithrandir.company.com is NXDOMAIN-IPv6
May 12 15:07:52 dnsmasq[11970]: query[A] mithrandir.com from 10.10.31.15
May 12 15:07:52 dnsmasq[11970]: forwarded mithrandir.com to 172.17.14.19
May 12 15:07:52 dnsmasq[11970]: reply mithrandir.com is NXDOMAIN-IPv4
May 12 15:07:52 dnsmasq[11970]: query[AAAA] mithrandir.com from 10.10.31.15
May 12 15:07:52 dnsmasq[11970]: forwarded mithrandir.com to 172.17.14.19
May 12 15:07:52 dnsmasq[11970]: reply mithrandir.com is NXDOMAIN-IPv6

You can see windows asks about mithrandir.company.com, then fails and tries mithrandir.com. It never tries just mithrandir which my DNS would know how to resolve.

I can't really fiddle with the settings on the Windows machines much, outside of changing the preferred DNS server.

Is there some way I can work around this issue? I really don't want my DNS to answer things for company.com since I don't own that domain and have nothing to do with it.

Best Answer

What you will need to do is configure the search domain for the Windows PC.

You haven't given details on which version of Windows you're running, but for Windows 7 (shamelessly stolen from this SuperUser answer):

  • Go to Control Panel → Network and Internet → Network and Sharing Center.
  • Click on Change Adapter Settings on the left side.
  • Right-click on your network adapter (normally "Local Area Connection") and select Properties.
  • Select Internet Protocol version 4 (TCP/IPv4) and click on the Properties button.
  • On the General tab, click on the Advanced… button.
  • In the Append this DNS suffixes list, add the domains you want, like google.com.
Related Topic