Solved

Windows Server 2008 with DNS doesn't resolve Localhost locally

Posted on 2009-04-14
14
3,622 Views
Last Modified: 2013-11-25
Hi All

I have a pretty weird issue... After installing DNS on my MS Server 2008 looking up localhost on the server doesn't resolve...
I've tried adding Host records to localhost even installed WINS but keep getting Non-existent domain when looking up localhost.

Is this by design? or can I resolve this issue?

Thanks in advance...
0
Comment
Question by:unluckynelson
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 5
  • 4
14 Comments
 
LVL 6

Expert Comment

by:Justin_W_Chandler
ID: 24143509
you must add it to the LMHOSTS file, not the HOSTS file.
0
 
LVL 1

Author Comment

by:unluckynelson
ID: 24145955
Ok, thanks for reply...
I searched my box for a lmhosts file but couldn't find any... except lmhosts.sam... which was a sample file
So I created one in the same place windows\system32\drivers\etc....

Sorry didn't work...

Any other ideas?
0
 
LVL 71

Expert Comment

by:Chris Dent
ID: 24146139

Localhost is defined in Hosts, not LMHosts.

> but keep getting Non-existent domain when looking up localhost.

Exactly how are you doing  that? "nslookup localhost" will fail, but "ping localhost" should work.

Chris
0
Turn Insights into Action

Communication across every corner of your business is essential to increase the velocity of your application delivery and support pipeline. Automate, standardize, and contextualize your communication processes with xMatters.

 
LVL 6

Expert Comment

by:Justin_W_Chandler
ID: 24151339
CHRIS: I'm sorry but you're mistaken. The hosts file identifies qualified domain names and subdomains (i.e. localhost.com or where.localhost.net). The LMHOSTS file identifies netbios names (i.e. localhost)

localhost is a reserved netbios name by the system and it should be unnecessary to add it to LMHOSTS. I'm not sure where your problem presently lies. Can you run an NSLOOKUP LOCALHOST and give the output? If your machine is a domain member you should see an entry for localhost.domain.com.

Justin Chandler
0
 
LVL 71

Expert Comment

by:Chris Dent
ID: 24152913

Sorry Justin, but I'm not.

Have you actually opened hosts? Because if you do, you'll see an entry just like this one:

127.0.0.1       localhost

LMHosts, if it exists as more than a sample file, by default contains nothing more than comments (prefixed with #). It is used only to map NT LAN Manager names to IP addresses.

Hosts is used to map hostnames to IP addresses. That doesn't have to be a fully qualified name, it can be single label names as is the case with localhost or any other single label name you might choose to add.

DNS can also be used to query "localhost" if, and only if, a zone is configured for that. Localhost tends to be, but is not always, present as a default zone file. Whether or not it exists on the DNS server in question is moot if the Hosts file contains the default entry above as Hosts is queried before DNS by the DNS Client (nslookup bypasses the DNS Client entirely).

As such, NsLookup can return an NXDOMAIN response where Ping might return 127.0.0.1. This is because Ping will resolve using the DNS Client, and therefore pay attention to Hosts, where NSLookup queries the name server directly which may not necessarily contain an answer for localhost.

Chris
0
 
LVL 6

Expert Comment

by:Justin_W_Chandler
ID: 24152974
Indeed you are right. My mistake. I had a brain fart, yet clearly contradicted myself as I suggested using NSLOOKUP LOCALHOST. As NSLOOKUP can be used to query localhost, it is definitely a hostname that should be located in the hosts file. *smacks forehead*

Justin Chandler
0
 
LVL 6

Expert Comment

by:Justin_W_Chandler
ID: 24152982
One thing to note, however... even without a hosts file, localhost should resolve to the loopback IP. This means his problem lies elsewhere, wouldn't you agree?

Justin Chandler
0
 
LVL 71

Expert Comment

by:Chris Dent
ID: 24155422

Yep, it should, because Windows likes to resolve that name regardless of what you put in Hosts.

But I suspect the reason for failure is that this is being tried:

NsLookup localhost

That will only work if nslookup is explicitly instructed to resolve it as a single label name:

NsLookup localhost.

The terminating period has NsLookup pass the request to the DNS server without appending any suffixes. Without it NsLookup will append each Suffix (Primary, and any list) then give up, never requesting the name alone. That behaviour can be seen using Set Debug, or Set D2 within the NsLookup prompt.

Chris
0
 
LVL 1

Author Comment

by:unluckynelson
ID: 24155739
Thanks guys for your responses.

'Nslookup localhost' returns non-existent domain.
'ping localhost' does the same...
So does 'nslookup localhost <server-ip>' or <server-fqdn>
My server is not part of a domain (which i suspect might be the cause from your responses) because i use it as a super-workstation. I don't want it part of a domain or setup active directories just to make it resolve localhost...

My only reason for trying to resolve this issue is because it is annoying to replace all my php and mySql code and DW sites with an IP address...

Thanks again...  






0
 
LVL 71

Expert Comment

by:Chris Dent
ID: 24155756

Could you verify that Hosts (when you open it in Notepad) does contain a "localhost" entry and that "Users" have Read and Execute permission when you look at the Security?

Chris
0
 
LVL 1

Author Comment

by:unluckynelson
ID: 24157213
Hi Chris

Yes, the host file does contain the entry:
127.0.0.1         localhost

I have checked now and ping localhost does resolve to 127.0.0.1 but times out? Apologies, please correct my previous comment..

What does that leave us with?

Thanks again
0
 
LVL 71

Accepted Solution

by:
Chris Dent earned 400 total points
ID: 24157241

Can you ping it's own IP and get a response?

If not, it may well be the Windows Firewall blocking (Inbound) ICMP which is required for ping to get a reply. You'd have to create an exception to allow it. However, that shouldn't effect any applications you're using on the server.

Chris
0
 
LVL 6

Assisted Solution

by:Justin_W_Chandler
Justin_W_Chandler earned 100 total points
ID: 24158910
Took the words right out of my mouth... very likely a firewall issue blocking echo requests.
0
 
LVL 1

Author Comment

by:unluckynelson
ID: 24844551
I arse an idiot... It was 2008's advance firewall stuff... stopping the service worked...
0

Featured Post

Raise the IQ of Your IT Alerts

From IT major incidents to manufacturing line slowdowns, every business process generates insights that need to reach the people required to take action. You need a platform that integrates with your business tools to create fully enabled DevOps toolchains.

You need xMatters.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

One of the most often confused topics in the area DNS is the idea of GLUE records. Specifically, what they are, when they are needed, when they are provided, and how they are created. First, WHAT IS GLUE? To understand GLUE, you must first under…
I've written instructions for one router type, but this principle may be useful for others of the same brand and even other brands of router. Problem: I had an issue especially with mobile devices that refused to use DNS information supplied via…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question