Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Is there any way to resolve hostnames without added to hosts file?

In order to access internal site in my company I have to add the host-name and IP in the .../etc/hosts file. Is there any way to add this in DNS server or active directory instead of manually add this to 100 computer.

share|improve this question
3  
Any reason why you Can't just add it to your DNS? –  uSlackr Apr 3 '12 at 17:09
    
I thought this was automatic for windows computers that join to the Windows domain. They get added to DNS. You normally never need hosts files. –  Matt Apr 3 '12 at 17:20
    
Say more about "I have to add the hostname and IP in ...etc/hosts". Do you need to add the host/IP of the internal site to hosts file or the host/IP of the clients? –  uSlackr Apr 3 '12 at 17:24
    
The host and IP is already in DNS manager !!! –  Mekko Apr 3 '12 at 17:51
1  
You should never have to touch your hosts file in a properly configured DNS environment. It sounds like something is incorrectly configured, but based on the scant amount of details given, it's impossible to say whether or not the problem is with your workstation, the DNS server, or the DHCP server. –  MDMarra Apr 3 '12 at 18:38
add comment

3 Answers 3

First, all PCs in the organization need to be looking to a DNS server that you control. Use DHCP to populate client PC's network information with the proper DNS server to look to for resolution.

Next, simply add an A record for each DNS name / IP address combination that you want to add.

Further reading that should interest you:

share|improve this answer
    
We are using windows 2008r2 and I already added New host (A or AAAA) to DNS manager and all PCs are looking to a DNS server. So, if I uncomment the IP and hostname from hosts file I am unable to access the site. –  Mekko Apr 3 '12 at 17:50
    
Flush the DNS cache on the client PC after you remove the entry in the hosts file. ipconfig /flushdns After that, try to resolve a DNS name that you've added to the server. Use nslookup on the client (make sure that it's pointing to the right DNS server) and see what the response is when you try to resolve that DNS name. –  Wesley Apr 3 '12 at 17:53
    
The nslookup is giving me the right IP that I am adding to etc/hosts file after I flushed the DNS but still when I try to browse the site I get this webpage is not available. –  Mekko Apr 3 '12 at 18:04
    
@Mekko: You're saying that your host/FQDN is in your DNS server. If you don't have the hostname in your host file, and do an nslookup on the client, the correct IP appears. But if you try to web browse to that host, you're getting an error. –  Bart Silverstrim Apr 3 '12 at 18:14
    
If you add that host to your host file, then try web browsing to that host, the website comes up fine. –  Bart Silverstrim Apr 3 '12 at 18:14
show 11 more comments

Yes, there most certainly is, it is even well-documented, over at TechNet: Add a host (A) resource record to a zone

share|improve this answer
    
Unfortunately, this not helps –  Mekko Apr 3 '12 at 18:28
add comment

Judging by your comments, your internal (AD) and external domain namespaces overlap, meaning that your internal AD domain name is company.com and your external site is also company.com.

This is bad. You should strongly consider doing an AD domain rename and changing it to something like internal.company.com or ad.company.com. If you don't, you're going to have to manage two sets of DNS records, one for each side of the infrastructure as well as having to do some IIS/DC voodoo on your DCs to make company.com reachable from the inside.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.