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.

options{

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

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

};

Logging example

logging{

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:

local1.info   /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 “www.domain.com” {

type master;

file “filename”;

};

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

masters { 192.168.0.1; };

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 .in-addr.arpa. For instance for 192.168.0.10 the first row is:

zone “10.0.168.192.in-addr.arpa” {

$TTL 3h; @ SOA ns1.invata-linux.ro. admin.invata-linux.ro. ( 3 ;serial 3h ;refresh in 3 hours 5m ;retry in 5 minutes 3w ;expire in 3 weeks 1h ;min in 1 hour ) NS ns1.invata-linux.ro. MX 10 mail.invata-linux.ro. ns1.invata-linux.ro. A 192.168.0.16 invata-linux.ro. A 192.168.0.16 mail A 192.168.0.1 www CNAME mail pc1 A 192.168.0.11 pc2 A 192.168.0.12
Uncategorized