Thursday, July 31, 2008

hosts file ignore in Windows

Got a new Windows XP box at office. After I added a host-ip mapping in the c:\winnt\system32\drivers\etc\hosts file, I still could not ping to the host. It seemed that the hosts file was ignored.

Ping request could not find host dse-750-test1. Please check the name and tryagain.

I did some research in the internet. The most common solution is to ensure the following registry value is correct, as it may be altered by some software.

Key: HKLM\system\currentcontrolset\services\tcpip\paramters
Value: DataBasePath
Type:REG_EXPAND_SZ
Data:%SystemRoot%\system32\drivers\etc


Some also mention the ipconfig /flushdns command, and to restart the DNS client service.

Others use filemon and regmon tool to trace. They found the following error message:

OPEN C:\WINDOWS\system32\drivers\etc\hosts ACCESS DENIED NT AUTHORITY\NETWORK SERVICE

After added the user to the security tab (with READ ONLY access), it solved the problem.

However, none of them seems to work in my case.

Finally, I found the solution: rename the hosts file and create a new one; then restart the DNS Client Service. It worked. Modifying the hosts file and restart the service did not work, even a reboot did not.

32 comments:

Anonymous said...

YES, YES, YES
It works.
my hosts file:
127.0.0.1 localhost.net
127.0.0.1 localhost

Anonymous said...

Oh my GOD that was driving me nuts. Thankyout hankyou thankyou ! Even in safe mode my hosts file was in denial... But I have you now ! BWAHAHAHAHA.
HEY EVERYBODY ! This is the ultimate Host File Access Denied fix over here !

Steve said...

This is STILL driving me crazy..

Ive got a computer, presumably infected with a virus, but I can't find anything about it. I can ping most stuff and it resolves, but whenever I ping a site that may be used for fixing the problem, it resolves to 127.0.0.1. I suspected the old hosts hijack trick, but that's not it, and putting something directly into hosts isnt overriding this problem.. It's like something is preloading the dns cache (which I've turned off, by the way!!)

Does ANYONE know where this may be coming from?

Thanks!

Steve said...

This is STILL driving me crazy..

Ive got a computer, presumably infected with a virus, but I can't find anything about it. I can ping most stuff and it resolves, but whenever I ping a site that may be used for fixing the problem, it resolves to 127.0.0.1. I suspected the old hosts hijack trick, but that's not it, and putting something directly into hosts isnt overriding this problem.. It's like something is preloading the dns cache (which I've turned off, by the way!!)

Does ANYONE know where this may be coming from?

Thanks!

Anonymous said...

THANK YOU!

Renaming and creating a new file worked!

But why? Whatever, it WORKS!

Anonymous said...

Awesome... worked for me too! I simply renamed the original, copied it to a new file, renamed the new file "hosts", then restarted the DNS Client. To do the last task, right click on My Computer, then "Manage". Click on "Services", select "DNS Client", then click on the restart button on the top toolbar.

Anonymous said...

Just found another reason for WinXP to ignore the hosts fileIf the machine has no DNS server specified (possible if using a static IP address) and the service named "DNS Client" is not started, Windows will ignore the contents of the hosts file.

You might say this is some sort of useless configuration but still one of our customers had it: A few PCs and other devices forming their own little network without connection to the Internet. And as he didn't want to set up an DNS server he just copied his hosts file to every computer. And because he doesn't use DNS he also set the above mentioned service to "disabled".

It took me days to find out, why the hosts file was ignored.

Probably this problem is also related to other versions of Windows. I tested only on WinXP.

Anonymous said...

ty, helped me allot

Anonymous said...

Brilliant! Thank you!

Daniele said...

thank you. Posted on fb and will soon cite this on my blog.
really saved my day.

Anonymous said...

If nothing of above works,
Check if you have a proxy configurated, usually office computers have one

Anonymous said...

Cant thank you enough. Creating new host file worked!!!!!

Anonymous said...

Well in my case, I was using powershell to update the host file. Out-File uses UNICODE as its default format. When creating a new file, notepad defaults to ANSI which windows likes.

Anonymous said...

FYI - You don't need to rename the hosts file - simply restarting the DNS Client worked for me.

Anonymous said...

I struggled a lot figure out the problem. Thanks for the tip.

Anonymous said...

This design is steller! You definitely know how to keep a reader
entertained. Between your wit and your videos, I was almost moved to start
my own blog (well, almost...HaHa!) Excellent job. I really loved what you had to say, and more than that,
how you presented it. Too cool!

Look into my weblog ... marketing by video

Anonymous said...

Hi there! This is kind of off topic but I need some guidance from an established blog.
Is it tough to set up your own blog? I'm not very techincal but I can figure things out pretty quick. I'm thinking about creating my own but
I'm not sure where to start. Do you have any ideas or suggestions? Appreciate it

Also visit my blog :: San Diego life insurance

Anonymous said...

Hi there, I found your website by the use of Google while looking for a
similar topic, your website got here up, it looks good. I've bookmarked it in my google bookmarks.
Hello there, just became aware of your weblog thru Google, and located that it's truly informative.
I'm gonna be careful for brussels. I will appreciate for those who continue this in future. Numerous other people can be benefited from your writing. Cheers!

my web site :: favorite San Diego video firm

Anonymous said...

Oh my goodness! Incredible article dude! Thank you, However I am having troubles with your RSS.

I don't know why I am unable to join it. Is there anybody else having the same RSS issues? Anyone who knows the answer can you kindly respond? Thanx!!

Also visit my webpage ... masseuse in Costa Mesa helps me

Anonymous said...

Terrific work! That is the type of info that should be shared around the net.
Disgrace on Google for now not positioning this submit higher!
Come on over and visit my website . Thanks =)

Have a look at my blog: making meaning übersetzung []

Anonymous said...

I love what you guys tend to be up too. Such clever work and reporting!
Keep up the excellent works guys I've added you guys to my own blogroll.

Here is my webpage: youtu.be/1NAC6cN5fS0 (alexsyaoi.blogspot.com)

Anonymous said...

I sympathize with this here on "hosts file ignore in Windows".
We are in Orange County|an Orange County real estate.


my web-site: good Orange County realtor reveals tricks

Anonymous said...

If some one desires expert view on the topic of blogging then i propose him/her to visit this blog,
Keep up the nice work.

Here is my web page; eye wrinkle cream reviews

Anonymous said...

Whether you want a cosmetic surgery () Edmonton or nose job
Edmonton, an accredited cosmetic surgeon will work with you to get the best results.

Furthermore, he is a specialist of almost all cosmetic procedures.
These are just a few of the many birth defects that might
qualify for medically necessary cosmetic procedures.

Anonymous said...

Hey! This is my 1st comment here so I just wanted too giuve a quick shout out and tell you I truly enjoy reading your blog posts.
Can you recommend any other blogs/websites/forums that deal with the same topics?
Many thanks!

Also visit my website; venapro negative reviews

Anonymous said...

Today, while I was at work, my sister stole my iphone and tested to see if it
can survive a thirty foot drop, just so she can be a youtube sensation. My apple ipad is now destroyed and she has 83 views.
I know this is entirely off topic but I had to share it with someone!


Here is my weblog: ipad stylus

Anonymous said...

What's Taking place i am new to this, I stumbled upon this I
have found It absolutely helpful and it has helped me out loads.
I hope to give a contribution & help different users like its aided me.
Great job.

Feel free to visit my web-site; Free Brazzers Accounts - http://freebrazzersaccounts.net/ -

Anonymous said...

I'm not sure exactly why but this site is loading very slow for me.
Is anyone else having this problem or is it a
problem on my end? I'll check back later and see if the problem still exists.


Feel free to surf to my page - test instruments

Anonymous said...

On the positive result, it doesn't, luteal phase you will be banned.
You've got to get a negative result to a bigger family.



Feel free to surf to my website :: best pregnancy test

Unknown said...

www1126



coach factory outlet
prada shoes
air max 90
ugg outlet
canada goose outlet
pandora charms
hugo boss
true religion jeans
issey miyake
ray ban sunglasses

yanmaneee said...

adidas yeezy
adidas yeezy
air max 270
michael kors outlet
christian louboutin shoes
nike air max 270
michael kors bags
nike air max 95
kd 11 shoes
michael kors handbags

stesyveau said...

read this article replica wallets go to this site Fendi Dolabuy go to website Hermes Dolabuy