Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question
    
Not an answer as it doesn't solve anything - but 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. If it does solve, tell me and I will write this as an answer. –  William Hilsum Dec 23 '09 at 3:50
    
In essence I think you were right. I was unable to run SFC because I no longer have my install disks (the installation is years old when I was working in a different company). However after managing to install SP1 and SP2 and applying all windows updates the hosts file is now working. Please post a separate answer and I will accept it. –  rwired Feb 1 '10 at 5:01

5 Answers 5

up vote 2 down vote accepted

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.

share|improve this answer

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.

share|improve this answer
    
+1 good diag tip, and nice article. wish you'd've included a link(s) to the fix here, and the caveat that it's only for XP and earlier. i wouldn't expect you to completely reproduce the article here (although it'd be welcome if you wanted), but a bit more info in your summary would be appreciated. –  quack quixote Dec 23 '09 at 8:27
    
I will try that, although DNS and ping are working just fine for normal sites. –  rwired Dec 23 '09 at 8:57
    
I'll update this with more details when I get a few minutes over the holiday weekend. –  fencepost Dec 24 '09 at 6:20

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.

share|improve this answer

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

share|improve this answer

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.