localhost and DNS vs hosts file
I just ran into a problem that I could not connect to MySQL on localhost. WHen changing localhost to 127.0.0.1, things worked. Than I fount that the etc\hosts file had the entry for localhost commented out. The comment in the hosts file read: "name resolution is handled within dns itself" Interestingly enough, a number of programs did not find this issue. But now my question is where/how do I check that this entry is correct in the DNS service and does anyone have any idea what I need to do (other than editing localhost in the hosts file) to make this work as was intended?
September 21st, 2010 2:44pm

Editing the HOSTs file should be all that is needed to update ip to name resolution locally for a client system. If you need to flush out the local resolver cache, refer to ipconfig commands. http://technet.microsoft.com/en-us/library/cc781949%28WS.10%29.aspx In an environment where it's just the localhost client, the local DNS Client service handles the initial resolution http://technet.microsoft.com/en-us/library/cc775637%28WS.10%29.aspx
Free Windows Admin Tool Kit Click here and download it now
September 21st, 2010 3:20pm

Oh dear &deity, I should learn NOT to ask questions on these "social" forums. :(
September 21st, 2010 4:31pm

You should give others a chance before you give up. I have not personally come accross the issue you described where the hosts file had the localhosts entry commented out, but the way that I have resolved to ensure that "localhosts" is resolved correctly in all cases, is by creating a host (A) record entry in your foward lookup zones called "localhost" and point it to 127.0.0.1. This will ensure that if anyone has purposely removed the localhost entry from the hosts file or if it has been commented for some reason, your DNS client will perform a lookup in the primary zone for a record called "localhost". Of course, the OS will append the domain suffix, but it wont matter since it will find it in DNS and return the correct IP. If you have more than one zone, I would create this record in each zone to ensure that all hosts are covered, no matter what domain suffix they are configured to use for DNS. I hope that this at least partially answered your question on what can be done to mitigate this issue without having to modify the local hosts file as you requested. Visit: anITKB.com, an IT Knowledge Base.
Free Windows Admin Tool Kit Click here and download it now
September 21st, 2010 7:50pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics