BIND DNS Server Configuration

You will need to create several files for a name server.
The name server "hint" file "db.cache",
The domain name database files "db.domainname", and
The name server configuration file "named.conf"
To build the hint file you just need to run this command
dig @rs.internic.net . ns >db.cache
You will need to create a "localhost" file and a file for each domain name that the name server will be responsible for
We'll create the "localhost" file first:
example file
$TTL 86400 ; minimum TTL as of bind 8.2
0.0.127.in-addr.arpa. IN SOA <primary name server>. <email>.<domain name>. (
1999122601 ; Serial
10800 ; Refresh after 3 hours
3600 ; Retry after 1 hour
604800 ; Expire after 1 week
86400 ) ; Minimum TTL of 1 day

0.0.127.in-addr.arpa. IN NS <primary name server>.
0.0.127.in-addr.arpa. IN NS <secondary name server>.

1.0.0.127.in-addr.arpa. IN PTR localhost.
  1. The <primary name server>. is the name of the primary name server
    ie. ns1.server-resources.com. (notice domain names are always followed with . if you miss this . you will get errors)
  2. <email>.<domain name>. would email the email address (replacing @ with .) of the person responsible for the name server
    ie. admin.server-resources.com. (notice again the following . )
  3. The "Serial" is the serial number of the name record, I represent it as year month day record. This way when a record is changed the name server will know the record has been changed
  4. "Refresh" tells other name servers how long to cache this information before the attempt to request the information again (represented in seconds)
  5. "Retry" tells other name servers how long to wait before the retry after a failed refresh (represented in seconds)
  6. "Expire" tells other name servers how long to hold this information before removing it (only if query attempts fail) (represented in seconds)
  7. "Minimum TTL" the minimum amount of time to keep this record cached before removing it (only if query attempts fail) (represented in seconds)
I save this file as "db.127.0.0"

Now for a domain name record:
example file
$TTL 86400 ; minimum TTL as of bind 8.2
<domain name>. IN SOA <primary name server>. <email>.<domain name>. (
1999122601 ; Serial
10800 ; Refresh after 3 hours
3600 ; Retry after 1 hour
604800 ; Expire after 1 week
86400 ) ; Minimum TTL of 1 day

<domain name>. IN NS ns1.server-resources.com.
<domain name>. IN NS ns2.server-resources.com.

<domain name>. IN RP <email>.<domain name>. <email>.<domain name>.

localhost.<domain name>. IN A 127.0.0.1

<domain name>. IN A <ip address>.

<domain name>. IN MX 0 <mail server>.

*.<domain name>. IN CNAME <domain name>.
  1. <domain name>, The domain name your are defining
    ie. server-resources.com. (notice the following . )
  2. <primary name server>., The primary name server
    ie. ns1.server-resources.com. (notice the following . )
  3. <email>.<domain name>., the email address (replacing @ with . ) of the person responsible for this domain name
    ie. admin.server-resources.com. (notice the following . )
  4. Refresh, Serial, ect are same as defined above but only apply to the record they are in
  5. <ip address>, The ip address for this domain name
    ie. 209.254.1.68
    Multiple lines can be defined if multiple ips are being used
    ie. www.server-resources.com IN A 209.254.1.69
  6. <mail server>, the name of the mail server for this domain name
    ie. mail.server-resources.com
  7. *.<domain name>., is the subdomains that will be used for this domain
    ie. www.server-resources.com
    the * is a wildcard so that this entry will cover any sub domain name such as www or www2 or web
  8. IN A records define domain names to ip addresses
  9. IN CNAME define canicol names or subdomains that refer to a previously defined ip
I would save this file as "db.server-resources.com"
Move the "db" files to your named directory (usually /var/named)
Now to build the server configuration file "named.conf"
example file
// generated by named-bootconf.pl
options {
directory "/var/named";
check-names master warn;
/*
* 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;
};
zone "server-resources.com" in {
type master;
file "db.server-resources";
};
zone "0.0.127.in-addr.arpa" in {
type master;
file "db.127.0.0";
};
zone "." in {
type hint;
file "db.cache";
};
  1. directory "/var/named", the directory containing the "db" or database files
  2. zone "server-resources.com" in {, a zone definition
  3. type master, type of name server this will be for this domain name
  4. file "db.server-resources", name of the file containing information on this domain
The zone "0.0.127.in-addr.arpa" is your local host zone (required)
The zone "." is the hint file listing the root name servers
I save this file as named.conf
Place this file in /etc and restart your name server


Created by Red Dragon for Red Dragon Enterprises™.
Red Dragon Enterprises™ © Dec 2001. All rights reserved.