?
Solved

Windows Server 2008 with DNS doesn't resolve Localhost locally

Posted on 2009-04-14
14
Medium Priority
?
3,700 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
Bringing Advanced Authentication to the SMB Market

WatchGuard announces the acquisition of advanced authentication provider, Datablink, with one mission – to bring secure authentication to SMB, mid-market, and distributed enterprises with a cloud-based solution, ideal for resale via their established channel & MSSP community.

 
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 1600 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 400 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

Ransomware Attacks Keeping You Up at Night?

Will your organization be ransomware's next victim?  The good news is that these attacks are predicable and therefore preventable. Learn more about how you can  stop a ransomware attacks before encryption takes place with our Ransomware Prevention Kit!

Question has a verified solution.

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

Most DNS problems are VERY easily troubleshot and identifiable if you can follow the steps a DNS query takes. I would like to share the step-by-step a DNS query takes from the origin to the destination. _____________________________________________…
I will assume you are running a non-server version of some sort of Windows throughout this article. There are many flavors of Windows since Windows Server 2000 - 2008, XP Home & Pro, Vista Home & Pro, and Windows 7 Starter, Home, Pro, Ultimate, etc.…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

801 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