Centos – Router as primary DNS server, Server as alternate? (or vice versa)

bindcentosdomain-name-systemnetworkingrouter

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?

Best Answer

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.