Solved

Windows Server 2008 with DNS doesn't resolve Localhost locally

Posted on 2009-04-14
14
3,454 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
 
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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
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 to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

A Cisco router can be configured as a DHCP Server. There are advantages and disadvantages in making your Cisco router work as DHCP Server. Almost all the features for windows DHCP can be configured on Cisco-based DHCP server. Some of the features me…
Occasionally you run into the website or two that will not resolve properly using your own DNS servers.  Some people simply set up global forwarders for their DNS server.  I don’t recommend doing this because it can cause problems resolving addresse…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

743 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now