BIND DNS server

network

BIND (Berkeley Internet Name Domain) is an implementation of the Domain Name System (DNS) protocols and provides an openly redistributable reference implementation of the major components of DNS, including a DNS server (named), a DNS resolver library and tools for verifying the proper operation of the DNS server. The BIND DNS Server is used on the vast majority of name serving machines on the Internet, providing a robust and stable architecture on top of which an organization’s naming architecture can be built. The resolver library included in the BIND distribution provides the standard APIs for translation between domain names and Internet addresses and is intended to be linked with applications requiring name service.

Assume we want to run DNS services for the domain example.com. Note that we need to register this domain name and tell the registrar that the DNS server for this domain is the machine running BIND. We also want to run DNS services for the IP range 192.168.0.0/24. Note that we would use more than one nameserver in real-life situations, but for this example we only use one nameserver. On OpenBSD with BIND 9, the first file we edit is /var/named/etc/named.conf

zone "example.com" {
   type master;
   file "master/example.com";
};

zone "0.168.192.in-addr.arpa" {
   type master;
   file "master/0.168.192.in-addr.arpa";
};

The file /var/named/master/example.com contains the translation from names to IP addresses in the example.com domain.

@ IN  SOA  ns.example.com.  hostmaster.example.com. (
   2003060101 ; Serial (yyyymmddxx)
   86400      ; Refresh (1 day)
   7200       ; Retry (2 hours)
   604800     ; Expire (7 days)
   86400 )    ; Minimum (1 day)

IN      NS      ns.example.com.

example.com.    IN      A       192.168.0.1
www     IN      CNAME   example.com.
ftp     IN      CNAME   example.com.

host1   IN      A       192.168.0.1
host2   IN      A       192.168.0.2
host3   IN      A       192.168.0.3

The file /var/named/master/0.168.192.in-addr.arpa contains translations from IP addresses in the range 192.168.0.0/24 to names (in our case in example.com).

@ IN  SOA  ns.example.com.  hostmaster.yahoo.com. (
   2003060101 ; Serial (yyyymmddxx)
   86400      ; Refresh (1 day)
   7200       ; Retry (2 hours)
   604800     ; Expire (7 days)
   86400 )    ; Minimum (1 day)

IN      NS      ns.example.com.

1       IN      PTR     host1.example.com.
2       IN      PTR     host2.example.com.
3       IN      PTR     host3.example.com.

Leave a Reply

Your email will not be published. Name and Email fields are required.