Configuring Primary Nameserver On Linux via BIND

ISC’s BIND, the Berkely Internet Name Domain system, can be set up to act as: a primary nameserver, secondary nameserver, and a caching-only nameserver (or combinations of these). While configuring a DNS system per se is a beast of a task, setting it up to act as a nameserver for a local LAN network is pretty easy.

Before setting up BIND, knowledge of how the DNS system works is absolutely necessary. There are countless tutorials spread across the Internet which not only describe the ins and outs of the DNS system at length, but also clearly explain how to configure BIND in its various configurations.

BIND reads data and configuration information from several files. Under Slackware, these are: /etc/named.conf, /var/named/, /var/named/, /var/named/named.local, /var/named/, /var/named/ The first four files come, by default, with BIND, while the last two files need to be created by users according to their needs.

For demonstration, I am going to set up a domain “uaaa.rk” for a local network. Files required, in this setting, by BIND are: /etc/named.conf, /var/named/ayaz/, /var/named/ayaz/, /var/named/named.local, /var/named/ayaz/, /var/named/ayaz/

The contents of these file, as favours the scenario in question, are as follows:

options {
directory "/var/named/ayaz";
* If there is a firewall between you and nameservers you want
* to talk to, you might need to uncomment the query-source
* directive below. Previous versions of BIND always asked
* questions using port 53, but BIND 8.1 uses an unprivileged
* port by default.
//query-source address * port 53;

// a caching only nameserver config
zone "." {
type hint;
file "";

zone "localhost" {
type master;
file "";
allow-update { none; };

zone "" {
type master;
file "named.local";
allow-update { none; };

zone "uaaa.rk" {
type master;
file "";

zone "" {
type master;
file "";

$TTL 86400
$ORIGIN localhost.
@ 1D IN SOA @ root (
42 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum

1D IN NS @

$TTL 86400
@ IN SOA localhost. root.localhost. (
2006022707 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS localhost.

1 IN PTR localhost.

$TTL 86400
@ IN SOA ns.uaaa.rk. root.localhost. (
1h )

@ IN NS ns.uaaa.rk.
@ IN MX 0 mail.uaaa.rk.

localhost IN A

ns IN A
www IN A
ftp IN A
ssh IN A
mail IN A

$TTL 86400
@ IN SOA ns.uaaa.rk. root.localhost (
2 ; serial
28800 ; refresh
7200 ; retry
604800 ; expire
86400 ; ttl

@ IN NS ns.uaaa.rk.

; The first row are digits appended to 192.168.50., it seems.
1 IN PTR http://www.uaaa.rk.
1 IN PTR ssh.uaaa.rk.
1 IN PTR ftp.uaaa.rk.
1 IN PTR mail.uaaa.rk.

That is it! Start BIND, on Slackware, through /etc/rc.d/rc.bind, and voila! BIND is running.

Note: The files,, and named.local require no changes.

Tip: If BIND is bailing out mysteriously, execute it in debug mode by calling /usr/sbin/named -g. Doing so will, no doubt, save lots of your time.

3 thoughts on “Configuring Primary Nameserver On Linux via BIND

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s