• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 969
  • Last Modified:

PC's ignoring Host file entrys and using DNS


We have a few instances where we use a local host file to overide an address in DNS on certain servers / PC's. We are all finding that if we create an entry in the host file and specify a different IP address its ignored and still returns the address in DNS.

I have tried Flushing DNS on my local machines, is there anything else?

I though the default DNS resolution pattern was to query the local hosts file before the DNS server.
1 Solution
can you set the IP address to a static IP address?
you can also get the MAC address of the PC's, and assign the stated entries based on the MAC addresses - this still uses the DNS system, however, only a PC with X mac address will be assigned IP address X.X.X.X
It shouldn't matter if you are using static or dynamic addresses.
And I don't know how MAC addresses really fit into the picture... DNS is hostname to IP Address translation. MAC addresses fall into a different layer of the OSI model altogether because you can't route using a MAC address.

Anyhow, yes there is a default order that says to check the local hosts file before DNS.

However, depending on what the contents of your host file are, and whether there are aliases there, you may not have the information you want to be there.

For example, if you are looking for a server called "server1" and you have a host entry that looks like:          server1
Then it should work.

But your client won't only be looking for server1, it is looking for a fully qualified domain name, in which case you want your host file to show:          server1.mydomain.com

And of course, then there are the issues of NetBIOS resolution in which case only the short name is used. So the following addresses both ways:          server1.mydomain.com          server1

Without knowing the contents of the hosts file, or your DNS suffix search order, or the host you are looking for, it's harder to give a more complete answer.

Oh, and you were on the right track with one thing... if you have a cached resolution on the client, you'll need to do an ipconfig /flushdns before testing.
Mike KlineCommented:
There are some other ideas here:
When you flush the DNS then if you run a ipconfig /displaydns  what is the output?
Making Bulk Changes to Active Directory

Watch this video to see how easy it is to make mass changes to Active Directory from an external text file without using complicated scripts.

ncomperAuthor Commented:
Yes thats what i thought

I have added to my hostfile     testserver01     testserver01.mydomain.local

The address in DNS for the FQDN is

I have flushed dns but when it try and ping either the FQDN or just testserver01 it returns the address

I have pasted a section of the ipconfig command, im out of ideas, i can kind of see there could be netbios name resolution comming into effect when just pinging the hostname, nut the FQDN still ignoring the hosy file i cant see how / why.

  Host Name . . . . . . . . . . . . : ITPC06
  Primary Dns Suffix  . . . . . . . : mydomain.local
  Node Type . . . . . . . . . . . . : Broadcast
  IP Routing Enabled. . . . . . . . : No
  WINS Proxy Enabled. . . . . . . . : No
  DNS Suffix Search List. . . . . . : mydomain.local


ncomperAuthor Commented:
OK just got it working, i have renamed the hosts file on a couple of machines to hostsold and then created a new file and it works

Cant think of why the hosts files on multiple machines would corrupt though.
Mike KlineCommented:
Did you check the permissions/attributes on the prior hosts file versus the new one?  
Paul SolovyovskyCommented:
check lmhosts file and WINS, it may be overriding your hosts


Featured Post

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Tackle projects and never again get stuck behind a technical roadblock.
Join Now