4

Here's my hosts(with a single entry):

127.0.0.1 test

But it's not working any more:

C:\Documents and Settings\Administrator>ping test
Ping request could not find host test. Please check the name and try again.

Why?

UPDATE

It stops working ever since I used openvpn

UPDATE2

alt text

1
  • Perhaps the original one is encoded as something other than plain-text. Try renaming the file and creating a new plain-text file.
    – Synetech
    Aug 6, 2011 at 3:48

7 Answers 7

1

Your host file NEEDS the first entry to be 127.0.0.1 localhost to properly function, according to Microsoft. That may be an issue as well. Add that in then reboot and try

3
  • No, it doesn't have to be the first entry, and Windows 7 doesn't even put localhost to the hosts file. Oct 7, 2011 at 16:57
  • You're right that it doesn't need to be the first entry, my mistake. However, EVERY Windows 7 installation has it in there that I've seen Oct 7, 2011 at 17:24
  • They are commented-out, however, and ignored by the resolver. Oct 7, 2011 at 17:26
1

I had a similar problem trying to ping a machine across our VPN

I made two identical entries, each on a separate line, and that made it work

1

I had the same problem none of presented suggestions worked for me. I found the clue there: https://serverfault.com/a/50950/161292

I rigth-clicked on hosts file and went to Properties->Security->Advanced. then I checked Inherit from Parent and clicked 'apply'. That solved my problem.

0

You have a strange problem! But here are some ideas.

a)make sure you're opening the right file
notepad C:\WINDOWS\system32\drivers\etc\hosts

b)Check that the file path is right here at this registry key. Check that the path there is The actual HOSTS file location HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\DataBasePath

check that DataBasePath has value %SystemRoot%\System32\drivers\etc

c)you could also try running hijackthis. See if it lists something with key o1, that's host file redirection.. or something to do with it. you could then check the box and choose "fix checked"

You could give it up and do a system restore, which is likely to fix it if you can go back to a good time but it won't tell you what was wrong.. maybe some people will have some other ideas.

6
  • I've uploaded a snapshot of the register entries,and the value of DataBasePath is OK...
    – fms
    Jan 9, 2011 at 10:25
  • here's a long-shot, in internet explorer tools options connections, is proxy server unchecked? that is a general windows setting 'cos it affects chrome too. But it doesn't affect ping.. and probably wouldn't affect hosts either.. though i've heard of people using proxies for dns.. but worth a look.
    – barlop
    Jan 9, 2011 at 10:54
  • this answer superuser.com/questions/86751/… suggests some things, like sfc /scannow But it looks like the guy mainly just did an install of service packs and updates. So, I reckon a repair installation would have fixed it for him. Similarly, a system restore. But you may want to hang about and see if anybody has an interesting idea!
    – barlop
    Jan 9, 2011 at 10:57
  • @barlop: It certainly doesn't affect lower level tools such as ping. Jan 9, 2011 at 12:27
  • @gravvity as I thought then!
    – barlop
    Jan 9, 2011 at 16:02
0

If you just edited your host file, you maybe need to flush your dns table

ipconfig -flushdns

ping test

2
  • I think it might be ipconfig /flushdns. At least it is on XP.
    – jmort253
    Jan 9, 2011 at 10:29
  • I just tried ,still not working..
    – fms
    Jan 9, 2011 at 10:32
0

Check the advaced settings of your TCP/IP settings, make sure the LMHOSTS option is enabled.

enter image description here

2
  • 2
    LMHOSTS is a separate file from HOSTS, and only used for NetBIOS lookups. Oct 7, 2011 at 16:57
  • 1
    @grawity: That's true, but I've experienced that this setting applies to both files. Oct 7, 2011 at 18:15
0

Maybe this is overstating the obvious; The hosts file resides in C:\Windows\System32\drivers\etc if you have edited this file in a text editor ensure that it hasnt added an extension, as far as windows is concerned the file must have no extension ie hosts. not hosts.txt

1
  • You could also try: netsh interface ipv4 reset ipconfig /flushdns ipconfig /registerdns
    – Antony
    May 24, 2012 at 13:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .