My Hosts file broke: Ping request could not find host test

4

1

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

fms

Posted 2011-01-09T09:26:22.977

Reputation: 91

Perhaps the original one is encoded as something other than plain-text. Try renaming the file and creating a new plain-text file. – Synetech – 2011-08-06T03:48:52.390

Answers

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

kid_wonder

Posted 2011-01-09T09:26:22.977

Reputation: 11

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.

jszoja

Posted 2011-01-09T09:26:22.977

Reputation: 11

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.

barlop

Posted 2011-01-09T09:26:22.977

Reputation: 18 677

I've uploaded a snapshot of the register entries,and the value of DataBasePath is OK... – fms – 2011-01-09T10:25:14.700

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 – 2011-01-09T10:54:44.637

this answer http://superuser.com/questions/86751/possible-reasons-windows-system32-drivers-etc-hosts-is-not-working-appart-from-t 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 – 2011-01-09T10:57:16.617

@barlop: It certainly doesn't affect lower level tools such as ping. – user1686 – 2011-01-09T12:27:39.003

@gravvity as I thought then! – barlop – 2011-01-09T16:02:44.013

@fms "How do I reset the hosts file back to the default?" http://support.microsoft.com/kb/972034 <-- that's worth a try it's mentioned by one person there as something that worked for them

– barlop – 2011-01-09T16:04:24.713

0

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

ipconfig -flushdns

ping test

Joey

Posted 2011-01-09T09:26:22.977

Reputation: 1

I think it might be ipconfig /flushdns. At least it is on XP. – jmort253 – 2011-01-09T10:29:09.377

I just tried ,still not working.. – fms – 2011-01-09T10:32:34.020

0

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

enter image description here

Tamara Wijsman

Posted 2011-01-09T09:26:22.977

Reputation: 54 163

2LMHOSTS is a separate file from HOSTS, and only used for NetBIOS lookups. – user1686 – 2011-10-07T16:57:47.663

1@grawity: That's true, but I've experienced that this setting applies to both files. – Tamara Wijsman – 2011-10-07T18:15:06.267

0

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

Canadian Luke

Posted 2011-01-09T09:26:22.977

Reputation: 22 162

No, it doesn't have to be the first entry, and Windows 7 doesn't even put localhost to the hosts file. – user1686 – 2011-10-07T16:57:28.990

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 – Canadian Luke – 2011-10-07T17:24:48.777

They are commented-out, however, and ignored by the resolver. – user1686 – 2011-10-07T17:26:12.557

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

Antony

Posted 2011-01-09T09:26:22.977

Reputation: 1 125

You could also try: netsh interface ipv4 reset ipconfig /flushdns ipconfig /registerdns – Antony – 2012-05-24T13:14:46.823