Sign Doug's SOTR Petition!

Sign Doug's petition to his boss and help send him to Scotch on the Rocks in 2012!
Recent Entries
Contact Doug!
Learn About Doug!
View Doug Boude's online resume
updated 11/18/2009

View Doug Boude's profile on LinkedIn
Link to me!

Follow Doug Boude on Twitter
Follow me!

Be Doug's friend on Facebook
Befriend me!
(I promise not to follow you home)
OO Lexicon
Chat with Doug!
NO MORE CAREER
POLITICIANS!
Get Out Of Our House: Replacing congress with TRUE citizens!
You may also be interested in...
Web Hosting
best web hosting - top web hosting sites, thetop10bestwebhosting.com

Czech your Page Rank!
Check Page Rank of any web site pages instantly:
This free page rank checking tool is powered by Page Rank Checker service
Surf's Up!
Visit Egosurf.org and massage YOUR web ego!
My Score: 9,001
Doug's Books

Read (and recommend)

  • Men are from Mars, Women are from Venus
  • The Wisdom of Crowds: Why the Many Are Smarter Than the Few and How Collective Wisdom Shapes Business, Economies, Societies and Nations
  • Blink: The Power of Thinking Without Thinking
  • Head First Design Patterns
  • Transact-SQL Programming
  • What's So Amazing About Grace?
  • Just So Stories (Rudyard Kipling collection)

Reading

  • Prayer: Does it Make Any Difference?
  • Data Mining (Practical Machine Learning Tools and Techniques)
<< February, 2012 >>
SMTWTFS
1234
567891011
12131415161718
19202122232425
26272829
Search Blog

Recent Comments
Re: Basic Ajax Select List Filter in PHP (by opineemia at 2/02 8:47 PM)
Re: PHP vs COLDFUSION (by dougboude at 1/24 9:47 AM)
Re: PHP vs COLDFUSION (by WhatTheHeck at 1/23 7:03 PM)
Re: Recursive Functions in ColdFusion (by Marty McGee at 1/22 1:01 PM)
Re: SQL Forward Engineering with Visio 2003 Professional (by Rama at 1/10 11:05 AM)
Re: PHP Export to Excel Snippet (by rasha at 1/10 1:55 AM)
Re: Fredrick "French" Fry (by Picky eater at 1/09 2:21 PM)
Re: Disappearing IE Popup Window During Save/Open Dialog (by Vivekanand at 1/06 12:51 AM)
Re: Just What IS a 'Service Layer', Anyway? (by Ashishkumar Haldar at 1/05 7:49 AM)
Re: Viewing Option Text (in IE7) that's Wider than the Select List (by ranjit sachin at 12/20 6:22 AM)
Re: Recursive Functions in ColdFusion (by Jason at 12/15 12:13 PM)
Re: Viewing Option Text (in IE7) that's Wider than the Select List (by kt at 12/08 3:47 AM)
Re: PayPal IPN Coldfusion CFC (by Guest at 11/28 6:11 PM)
Re: SQL Forward Engineering with Visio 2003 Professional (by freddy villamil at 11/09 2:49 PM)
Re: Finally Found a Use for CFTHREAD (by criclebrava at 11/09 1:23 PM)
Re: Finally Found a Use for CFTHREAD (by assisisowsfub at 11/07 10:37 PM)
Re: IRRITATING CF QUERY ERROR AND SOLUTION (by dougboude at 10/10 10:48 AM)
Re: Using Google as your CF Mail Server (by hlharkins at 10/09 10:24 AM)
Re: IRRITATING CF QUERY ERROR AND SOLUTION (by Peter Boughton at 10/07 3:15 PM)
Re: My Thoughts on the Current Presidential Contenders (by dougboude at 9/23 12:21 PM)
Categories
Archives
Photo Albums
Funnies (5)
Family (3)
RSS

Powered by
BlogCFM v1.11

28 July 2009
Hosts File Changes Not Acknowledged on Vista 64

I spent the better part of yesterday wrestling with what should not have been a problem in the first place. But, since it was, and since it managed to burn up the majority of a perfectly good day of development, I share this information in hopes that it will spare someone else my frustration.

The Scenario

You're OS is Windows Vista Home Premium, the 64 bit edition. You are attempting to set up a local dev environment using Apache and MySQL, but no matter what you try, the changes you make to your hosts file just will NOT become visible to your ping attempts! For instance, you add an entry such as "127.0.0.1   local.mydev", but when you go to a command window and try to "ping local.mydev", you get "host not found". SO not cool.

Editing the hosts file

Okay, a few words about editing the hosts file in Vista. Vista is very self-protective, even to the point of trying to protect you from yourself, so editing the hosts file requires that you do so with admin privileges. Ah, but just being logged in as an admin isn't enough; you have to start notepad (or whatever editor you're using) using the "run as administrator" option. Click Start, enter 'notepad.exe' in the search box, when it shows up in the results, right click it and choose 'run as administrator'. THEN you can open your hosts file and edit it. Make sure when you go to save it that you change the file type to *.any and overwrite the original file; By default notepad really really wants to create hosts.txt (which your browser would ignore). If you plan on making hosts file changes frequently, you may as well just set up a shortcut on your desktop that already has admn privs and already points to your hosts file. Create a new shortcut with the target property of "C:\Windows\System32\notepad.exe c:\windows\system32\Drivers\etc\hosts". Then click the 'Advanced' button on the shortcut tab and check the "Run as administrator" box. Now everytime you need to edit the hosts file, you'll already have admin privs to do so.

The Solution

SO THEN, back to the issue. At this point you know that your changes to the hosts file are being saved, but still no positive ping action taking place. After googling for hours and trying all SORTS of things, here are the steps I followed that gave me positive results.

1. First, make certain that the system is looking at the same hosts file you are. The odds that it's looking somewhere else are slim, but best to eliminate the possibility anyway. To verify hosts file location, you'll be launching regedit and looking for the value of the registry key "DatabasePath" in the Tcpip/Parameters (full key path: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters). The value should look similar to %SystemRoot%\System32\drivers\etc .

2. Stop the "DNS Client" service

3. Make sure that the hosts file name is all lower case. It shouldn't make a difference, but the information I found all references it that way and on Vista, it was actually named Hosts originally. Changing it's name can be a booger because of OS security, so to do so, see step 4....

4. Create a new hosts file. I tried using notepad, but could not get it to omit the ".txt" extension no matter what I tried, so ended up using EditPad Pro (freeware). Just delete or rename the old file, then create this new one, adding in the entries you need.

5. Go to a command window and test by trying to ping one of the entries you created. With the DNS Client service stopped, Vista should use your hosts file. At this point in the game, you should definitely have positive results.

6. Restart your DNS Client service, then re-test in a command window just to make sure it's still working as designed.

If you follow the steps above and it still doesn't work, I have no clue what to tell you except to perhaps try re-ordering the steps, toss in a reboot or two, try executing some ipconfig /flushdns commands. Some order of all of the above is what finally got me where I needed to be.

Oh,and if you learn anything in the process that I haven't caught on to, please come on back and leave that tidbit in the comments section of this post. If you do, all of your wildest dreams will come true.

Doug out.




Posted by dougboude at 10:50 AM | PRINT THIS POST! |Link | 5 comments
Subscription Options

You are not logged in, so your subscription status for this entry is unknown. You can login or register here.

Re: Hosts File Changes Not Acknowledged on Vista 64
The "ipconfig /flushdns" from a command prompt has always resolved DNS issues for me.
Posted by Dan G. Switzer, II on July 28, 2009 at 12:25 PM

Re: Hosts File Changes Not Acknowledged on Vista 64
Didn't do it for me. I flushed so much I felt like a restroom attendant; still couldn't ping my virtual domain.
Posted by dougboude on July 28, 2009 at 12:54 PM

Re: Hosts File Changes Not Acknowledged on Vista 64
I think for me it was the step number 4. I had first saved it improperly and even though I opened as admin and saved correctly on top of the old one it still didn't work. So openning a whole new Note Pad and copying the text in and resaving it as * all files did the trick.
Posted by redir on December 28, 2009 at 11:04 AM

Re: Hosts File Changes Not Acknowledged on Vista 64
Tried deactivating the DNS-Client service first. To my amazemend I could now ping the hosts that I added. After restarting the service, it was all gone though. No more resolving. I was about to try step4 since it already helped redir, but changed my mind to verify something. Upon opening the service, I could see the that it was to be run by the local pseudo user NETWORKSERVICE (I hope the translation to english is correct, as I'm running a German version of Vista 64). Examining the ACL on the hosts file, the networkservice was not explicitly mentioned but Users, Administrators and SYSTEM did have access. Adding the NETWORKSERVICE with full rights (probably read-only rights would have been sufficient), it magically worked right after that.

My guess is, that you, by creating a new hosts file, accidently gave permissions to the networkservice to actually read that file. I'm not quite sure, why it hadn't these rights in the first place.
Posted by Spacy on August 24, 2010 at 3:46 PM

Re: Hosts File Changes Not Acknowledged on Vista 64
Deactivating the DNS service was the step that did it for me, but doesn't that mean we have a flaw in Vista? MS documentation says that the order of resolving is 0 - check if request is to the local machine name, 1 - hosts, 2 - dns service

but it seems that if dns service is ON, it just skips the hosts check all together. ERR
Posted by robarwebservices on February 18, 2011 at 8:24 AM

Name:   Required
Email:   Required your email address will not be publicly displayed.

Want to receive notifications when new comments are added? Login/Register for an account.

Time to take the Turing Test!!!

Five plus Eleven equals
Type in the answer to the question you see above:

Your comment:

Sorry, no HTML allowed!