Possible reasons WINDOWS\system32\drivers\etc\hosts is not working (appart from the obvious)

07
2014-07
  • rwired

    Here's my C:\WINDOWS\system32\drivers\etc\hosts file:

    127.0.0.1          localhost
    192.168.100.1      router
    

    testing it:

    C:\>ping router
    Ping request could not find host router. Please check the name and try again.
    
    C:\>ping 192.168.100.1
    
    Pinging 192.168.100.1 with 32 bytes of data:
    
    Reply from 192.168.100.1: bytes=32 time<1ms TTL=64
    Reply from 192.168.100.1: bytes=32 time<1ms TTL=64
    Reply from 192.168.100.1: bytes=32 time<1ms TTL=64
    Reply from 192.168.100.1: bytes=32 time<1ms TTL=64
    
    Ping statistics for 192.168.100.1:
        Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
    Approximate round trip times in milli-seconds:
        Minimum = 0ms, Maximum = 0ms, Average = 0ms
    

    It used to work. I used to have numerous redirects in there. But it stopped working a few weeks ago.

    I've checked all the obvious:

    • deleted the hosts file and replaced with this simple one just for testing
    • no invalid characters in the hosts file
    • no file extension on the hosts file
    • not using TAB to separate IP and hostname (tried using exactly 8 spaces)
    • ipconfig /flushdns
    • restart the DNS Client service
    • permissions on the file matches the permissions of the DNS Client (I've also tried "allow" for "everyone" on both the hosts file, and the "etc" folder, and also the "drivers" folder).
    • tried adding the NETWORK SERVICE user, and the LOCAL SERVICE user to this file permissions
    • no anitivirus/spamware/malware/resident shields running on this particular machine
    • tried the hosts file both with UNIX and DOS EOL markers
    • reboot the machine

    What am I missing?

  • Answers
  • William Hilsum

    From what you have done, and the list of things you have checked makes me think some sort of system failure as it looks like you have done the correct things, try doing "SFC /SCANNOW" from the command line just to test for system problems.

  • fencepost

    Is this a problem with the hosts file not working or is it a problem with no DNS resolution at all working on the machine (ping, IE, etc.)?

    If the latter, does nslookup work?

    If so, take a look at When DNS and ping Fail but nslookup Works on my website for the long answer.

    Short answer is that after trying all sorts of things, I ended up with "Winsock XP Fix" which someone built some years back after noting that the registry entries related to WinSock were actually the same between systems, and that sometimes they end up corrupted.

  • Maarten

    Next time, check \HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\DataBasePath in the registry to see if the location of your hosts file is correct and the same as where Windows assumes it to be.

  • unxed

    Change hosts file owner to "Administrators" group. It fixed an issue for me.

  • Catalin DICU

    sfc /scannow didn't work for me but installing this .msi did : http://support.microsoft.com/kb/972034


  • Related Question

    acronym - What does the "etc" stand for in "c:\Windows\System32\drivers\etc\"?
  • Josh Comley

    This has been bugging me for ages, I'm assuming it's not just "etcetera"..!?

    I don't like not knowing the meaning of stuff, especially important directories!


  • Related Answers
  • Jonathan

    My guess is that it's just a carry-over from some UNIX programmer who switched to hacking windows in the early days of System32 windows. /etc in UNIX/Linux holds two (or more) potential meanings: et cetera or Extended Tool Chest (Here's a Slashdot debate arguing the point), and it's just a place to store configuration files and some minor utility scripts for a given program. Many times you will see hierarchical breakdowns within smaller software projects (such as a windows driver) that resemble the breakdown of the UNIX directory structure, no matter what OS you are on.