In my previous post, I did show how to create a policy respond zone (RPZ) to rewrite DNS records.
However, if you want to keep using your current DNS server and not have to re-do your zones, make the DNS server that uses RPZ a slave of your main DNS server.
If you have DNS server on the cloud, make sure that your provider will allow zone transfers from your IP.
If you host your own then just make sure you do not have a firewall rule preventing access locally.
If you need to add a server, go ahead and create a standard BIND server (or whatever DNS server you may want to use), I will be using BIND for the slave, it is up to you.
One note, you could use DNSMASQ as your primary, it is a fantastic tool. However it is useful for small shops, I mean 20 or less, if you have more than that you are better off using BIND.
Installing a master bind server is similar to what I described previously, it is fairly straight forward.
Before installing the slave one, make sure that the primary resolves and have records for the machines you need.
Now we need to make a few changes to the configuration we did.
On the bind folder rename both db.test.com and db.192.168.1, we will not need them since we will be transferring records form the master.
Edit “named.conf.options” and make sure that forwarders point to your master server.
Edit “named.conf.local” and change the following:
zone "test.com" {
// Below makes it a slave zone
type slave;
// IP of the master
primaries { 10.20.1.53; };
// file "/etc/bind/db.test.com";
file "/var/cache/bind/db.test.com";
allow-query { any; };
};
zone "192.168.1.in-addr.arpa" {
// Below makes it a slave zone
type slave;
// IP of the master
primaries { 10.20.1.53; };
// file "/etc/bind/db.192.168.1";
file "/var/cache/bind/db.192.168.1";
allow-query { any; };
};
We are using “/var/cache/bind” to store the transfers. Keep your entry for the RPZ zone. Make sure it remains a “master” zone.
Now, restart bind. If there are no errors, you should have a couple temp files in that folder.
If they are empty, check the logs and find out if the master if refusing connections, fix the issue.
If everything is ok, on the client just issue a few digs commands.
Use dig and resolve for google.com, then for a machine that should be in you network, in our case machine.test.com for example (remember you should have an A record already on the master).
Finally do a dig for one of the machines you want to re-write a record. It should work.
There you have it.
Ciao.
