PC's ignoring Host file entrys and using DNS

Posted on 2009-02-16
Last Modified: 2012-05-06

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.
Question by:ncomper
    LVL 4

    Expert Comment

    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
    LVL 13

    Expert Comment

    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:

    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

    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.
    LVL 57

    Expert Comment

    by:Mike Kline
    There are some other ideas here:
    When you flush the DNS then if you run a ipconfig /displaydns  what is the output?
    LVL 5

    Author Comment

    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


    LVL 5

    Author Comment

    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.
    LVL 57

    Accepted Solution

    Did you check the permissions/attributes on the prior hosts file versus the new one?  
    LVL 42

    Expert Comment

    check lmhosts file and WINS, it may be overriding your hosts

    Featured Post

    PRTG Network Monitor: Intuitive Network Monitoring

    Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

    Join & Write a Comment

    Do you have users whose passwords are expiring and they are constantly calling you?  Well I sure did and needed a way to put an end to this.  We have a lot of remote users which would not be notified that their passwords were expiring since they wer…
    Introduction You may have a need to setup a group of users to allow local administrative access on workstations.  In a domain environment this can easily be achieved with Restricted Groups and Group Policies. This article will demonstrate how to…
    This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
    This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles to another domain controller. Log onto the new domain controller with a user account t…

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now