Link to home
Start Free TrialLog in
Avatar of ncomper
ncomper

asked on

PC's ignoring Host file entrys and using DNS

Hi

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.
Avatar of mrsjock
mrsjock

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:
192.168.0.1          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:
192.168.0.1          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:
192.168.0.1          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.
Avatar of Mike Kline
There are some other ideas here:
http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/Windows/XP/Q_21604864.html?sfQueryTermInfo=1+file+host+ignor
When you flush the DNS then if you run a ipconfig /displaydns  what is the output?
Thanks
MIke
Avatar of ncomper

ASKER

Yes thats what i thought

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

The address in DNS for the FQDN is 10.100.1.10

I have flushed dns but when it try and ping either the FQDN or just testserver01 it returns the 10.100.1.10 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

Thanks

Nick
Avatar of ncomper

ASKER

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.
ASKER CERTIFIED SOLUTION
Avatar of Mike Kline
Mike Kline
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
check lmhosts file and WINS, it may be overriding your hosts

https://www.experts-exchange.com/questions/22010307/Hosts-vs-LMHosts-sam.html