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.

I have a web server hosted in the network. It has a domain name registered. However, I also host a DNS server for the LAN. So, when someone wants to access the web server, it would check the DNS server and use the internal address 192.168.x.x. The web server's public address is 203.x.x.x.

When my computer is working fine, I would ping or try nslookup www.mydomain.com. Both points to 192.168.x.x which is internal address. Sometimes, I or someone could not access www.mydomain.com. When I check, nslookup returns the internal address. But when I ping, it would try to connect using the public address like this.

Pinging www.mydomain.com [203.x.x.x] with 32 bytes of data:

If that happens, repairing the connection mostly help. Sometimes, the workstation (Win XP) has to be restarted. In DNS settings of the workstations, primary DNS points to the DNS Sserver and secondary DNS points to ISP DNS server.

What I want to know is the cause of this problem and prevention from it? Or a better fix than my current ones. Thanks

share|improve this question

2 Answers 2

up vote 7 down vote accepted

You've configured the client to lookup against your internal DNS for its primary, and an external DNS server as a secondary? You have a race condition; if the internal DNS happens to be too slow to respond, then the client gets an unusable response from the public DNS server. ping is using the cached response from the lookup against the external DNS server, while nslookup sends a fresh request that gets a valid response from your internal DNS server.

Having inconsistent views of DNS between your primary and secondary servers is bound to cause problems like this. Instead, either stand up a second internal DNS server and use it as secondary, or configure the client with no secondary DNS server at all.

share|improve this answer
    
Thank you. I have limited budget to have another DNS server. My current DNS server is running on Windows. For the secondary one, could I host it on bind using Ubuntu (or any free Linux distribution)? Is there a guide for doing so? –  h82 Jul 26 '12 at 7:22
1  
@h82 You could set up a second DNS server on BIND as a slave, yes, but it's probably simpler and easier for you to set up your DNS replica as a second Windows system, especially if DNS is active directory integrated. If you're set on going down this path, googling for "ubuntu bind slave" turns up some good options, just keep in mind that the steps those guides have for configuring the master to allow zone transfers to the slave will need to be translated to the equivalents for your Windows system. –  Shane Madden Jul 26 '12 at 16:04

This problem is caused by your using RFC1918 private addresses inside your internal network. As a result, you have to access the server using one address while on one side of the network and a different address on the other.

The short-term solution to this is to implement split-horizon DNS. This provides you consistent DNS entries within the network and without.

The long-term solution to this is to implement IPv6, in which you will have the same address for the server regardless of whether you're internal or external.

share|improve this answer
    
Thanks for the help. IPv6 would be a nice standard once I am able to use it. –  h82 Jul 26 '12 at 7:25

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.