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.

We have a very small business network, with a typical cable modem hooked into a DD-WRT router. We also run a basic CentOS server that does a variety of things, including acting as the primary DNS server for the office.

The reason we need an internal DNS server is because we do a lot of internal web development and use the DNS server to add/remove various local network URLs for internal website testing (like www.testsite.com.local). It's very important for us to be able to add/remove URL aliases easily to the DNS.

The problem with this setup is that if we ever need to restart the CentOS server or take it offline for upgrades or whatever, then internet access for all computers on the network is lost. That's because each computer relies on that DNS server to access the Internet I guess?

The router is online all the time and very very rarely has to be restarted. It would be nice if we could setup my router to be the primary DNS server but still be running DNS on my server. So we could still add my local testing website URLs to the DNS server in CentOS, but be able to also take down the CentOS server without loosing Internet access on the network.

How would this be setup? Would I simply need to add both router + server IP addresses to each computer's IP settings? Is the router primary DNS and server secondary DNS server? Or vice versa? Or can one of the two serve as a fallback for the other? What (if anything) needs to be configured on both the router and server in order for them to recognize that the other DNS server exists on the network?

Does anyone have any newb-friendly resources for setting up something like this?

share|improve this question
    
Please clarify: Is it required that the solution involve the router's DNS server? –  Tom Ligda Aug 29 '12 at 20:46
1  
Don't reboot the CentOS box during business hours? –  Michael Hampton Aug 29 '12 at 23:18
    
@TomLigda if there is another free solution then I would consider it. As it is now, there is a server and a router. –  Jakobud Aug 30 '12 at 1:58
add comment

2 Answers

Set your DHCP server (likely your router) to hand out leases with your CentOS box as primary DNS and the router as secondary. Reason being you would prefer your client pc's to use the CentOS box as this has the relevant records for our testing websites and anything else, and when you do have to take this box down, clients will fall back to your router which will serve DNS records for the public internet but will have no knowledge of your internal structure.

If you've managed to get DD-WRT installed, I doubt you will need a guide to make this change.

If the clients are using static ip details, then you will need to manually enter your CentOS box as primary DNS and your router as secondary.

Also ensure your router has correct DNS servers on it's WAN settings otherwise when your CentOS box goes down and clients use the router, it will have no idea where to get the DNS records from.

share|improve this answer
2  
The problem with this approach is that clients are not required to follow DNS priority. In principle, each DNS server is expected to hold the same data and return the same responses. Usually, Windows will honor the priority (though there have been issues where it has not), but this does not necessarily hold for other operating systems (or maybe even specific applications who decide to do their own DNS querying instead of relying on the OS) –  brain99 Aug 29 '12 at 19:57
    
@ brain99 : +1 - Good observation. Unfortunately my knowledge doesn't extend to a solution for this issue - if you have one, post it and your answer will probably be better then mine. –  Robin Gill Aug 29 '12 at 20:01
    
Is there some way to sync the server DNS entries to the router DNS? I know with bind you can do this, but DD-WRT's DNS isn't bind I don't think... –  Jakobud Aug 29 '12 at 20:09
    
Sorry I'm not certain whether DD-WRT actually caches DNS requests, and whether it is capable of using a DNS server on the LAN in place of one of the WAN DNS servers. You can try putting your CentOS box as the primary DNS server for the router, then set a client up with the router as the primary and sole DNS server and test what happens. –  Robin Gill Aug 29 '12 at 20:17
add comment

I can think of two solutions to your problem. In both cases, set the DNS for your clients to the dd-wrt router.

Option A: setup dd-wrt with your CentOS box as primary DNS, and your ISPs DNS as secondary DNS. In dd-wrt, you can enforce strict ordering of DNS servers, which overcomes the restriction I pointed out in response to Robin's answer. References: dd-wrt forum and dd-wrt wiki. Note that I am not sure this will work with your CentOS box on your LAN; if not, that leaves you with option B.

Option B: enter your local DNS entries in dd-wrt directly. A howto can be found on the dd-wrt wiki

share|improve this answer
    
+1 - I hadn't poked around DD-WRT enough to realise you can create DNS entries in there. That is probably the ideal solution IMHO. Also thanks for info on strict ordering - will read up on it. –  Robin Gill Aug 29 '12 at 20:22
    
Whats the purpose of ISP's DNS as secondary DNS instead of the router? I've never ever had to tell my routers to point traffic to my ISP's DNS server. I don't even know the IP of it... –  Jakobud Aug 29 '12 at 20:33
    
Normally your router picks this up using DHCP when it gets an IP address from your ISP, but if you go and manually set DNS servers you may have to explicitly add it. As for the address from your ISP's DNS server, just look at the current DNS server in dd-wrt. –  brain99 Aug 29 '12 at 20:36
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.