Solved

Windows Server 2008 with DNS doesn't resolve Localhost locally

Posted on 2009-04-14
14
3,541 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
  • 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 70

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
The New “Normal” in Modern Enterprise Operations

DevOps for the modern enterprise offers many benefits — increased agility, productivity, and more, but digital transformation isn’t easy, especially if you’re not addressing the right issues. Register for the webinar to dive into the “new normal” for enterprise modern ops.

 
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 70

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 70

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 70

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 70

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

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
DNS Settings for Domain controllers 22 133
Cisco AP to get ip from DHCP 10 98
Reverse DND setup 6 38
How IXFR works with BIND name server? 6 28
Configuring network clients can be a chore, especially if there are a large number of them or a lot of itinerant users.  DHCP dynamically manages this process, much to the relief of users and administrators alike!
Learn how to PXE Boot both BIOS & UEFI machines with DHCP Policies and Custom Vendor Classes
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

830 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