DNS – How to Configure Your Own DNS Server

dns

Okay. I've been researching for over an hour now and I did not find any useful help. What I'm essentially looking to do is, I want to create a custom DNS Server (just like google has 8.8.8.8, but not that complex).

For example: I could just map facebook.com –> some other IP address and send rest of the DNS traffic through 8.8.8.8. Then, when, in my router page, I change my DNS from 8.8.8.8 to mycustomIPAddress DNS (1.2.3.4 like), and I open facebook.com, it gets mapped to some other IP (say, just a blank page).

How do I do this? How do I get that "mycustomIPAddress DNS" to put into my router? Can anybody provide some sources to read?

Best Answer

If you need just override external DNS records then all you need - it some respectful DNS forwarder (I prefer Unbound), it works on unix based OS and Windows.

In the config file you can easily override DNS records for any domain you like just with two lines:

local-zone: "google.com." redirect
local-data: "google.com.  600 IN A 1.2.3.4"

To apply your changes to the whole LAN network, you need to run it on your root router that should support to run custom/additional software, so any clients on the network would use your rules.
Do not forget that if some one on your local network know IT stuff, they can manually set up their own preferences on their machines.
If it is a case then you need a decent firewall/router (Something like PFsense that have all you need) that can block outgoing connections to 53 port (DNS queries), so the only choice for your users would be to use your DNS. (Well, they can still tunnel their traffic, you can actually protect against it, but it out of scope of this thread)

Related Question