Bind: named.conf structure

named.conf sections

The named.conf consists of a general section (options, logging etc) and the zones section.

All lines (except the opening curly brackets only rows) must end with a semicolon.

The named.conf general section

The option container in named.conf.


directory /var/named/;             this is the base directory for all files referenced in named.conf

allow-transfer {; };           this is a secondary authoritative DNS server


Logging example


channel my_syslog{

syslog local1;

severity info;


category queries { my_syslog; };

category default { my_syslog; };


Also you need to modify /etc/syslog.conf like this:   /var/log/bind.log

Finally restart syslog and bind.

rndc key

include “/var/named/rndc.key”;

The rndc.key file will be generated with sbin/rndc-confgen -a.

The zones section

Domain zone file entry

It specifies 3 things: the domain (name or reverse resolution), if it’s primary or secondary and the zone file.

zone “” {

type master;

file “filename”;


In case of a secondary DNS server the type changes to slave and another line is required:

masters {; };

Negative resolution

The negative resolution zone pointer is the same as the normal one with the exception of the address: it is written in reverse and suffixed by For instance for the first row is:

zone “” {

$TTL 3h; @ SOA ( 3 ;serial 3h ;refresh in 3 hours 5m ;retry in 5 minutes 3w ;expire in 3 weeks 1h ;min in 1 hour ) NS MX 10 A A mail A www CNAME mail pc1 A pc2 A