DNS CNAME with ISC BIND

by wmbetts

It seems a lot of people get confused when it comes to messing with BIND config files, but they're really pretty simple.

Find the host file for your "zone" aka domain. Generally they are all stored in the same place. Mine are stored in /etc/namedb.

Find the file that containes your domain information and open it. I use pico or nano, because it's easy.

(shell command) pico <name_of_dns_zone_file>

The zone file should look something like the following:

$ttl 38400
<domain_name>.net. IN SOA <domain_name>.com. <domain_name>.net. (
1168403917 // THIS IS YOUR SERIAL NUMBER
10800
3600
604800
38400 )
<domain_name>.net. IN A <ip>

<end zone file>

**All domain_name instances should be some domain name, probably the one that the zone is for. ip should be some ip address.

**Your zone file may contain other types of records. This is perfectly fine.

At the very end of the file add the following line

community IN CNAME affiliate.kickapps.com.

Then change the serial number. The serial number in the example is 1168403917. In the example I would make the serial number 1168403918. Notice I just incremented the last digit by 1. If the last digit ends in 9 say it was 1168403919. I would then make it 1168403920 notice I just incremented the number next to it 1 and made it 0.

Save the file (if you're using pico type Ctrl-X and press y then enter). Then restart named (aka the bind daemon). Generally killall -9 named will kill the daemon then typing named will restart it. This is NOT always the case and you might want to research that before you do this. If you're using say fedora you might want to google "restart named on fedora" or "restart named on freebsd".

Did you enjoy this tutorial? Have questions or comments? Send a private message to the author of this tutorial or post a reply to the discussion where it was first published.