Free Hosting Online for WorkStations

< Previous | Contents | Next >

example.com with your FQDN (Fully Qualified Domain Name). 2.3.1. Forward Zone File

To add a DNS zone to BIND9, turning BIND9 into a Primary Master server, the first step is to edit /etc/ bind/named.conf.local:


zone "example.com" { type master;

file "/etc/bind/db.example.com";

};


(Note, if bind will be receiving automatic updates to the file as with DDNS, then use /var/lib/bind/ db.example.com rather than /etc/bind/db.example.com both here and in the copy command below.)


Now use an existing zone file as a template to create the /etc/bind/db.example.com file:


sudo cp /etc/bind/db.local /etc/bind/db.example.com


Edit the new zone file /etc/bind/db.example.com change localhost. to the FQDN of your server, leaving the additional "." at the end. Change 127.0.0.1 to the nameserver's IP Address and root.localhost to a valid email address, but with a "." instead of the usual "@" symbol, again leaving the "." at the end. Change the comment to indicate the domain that this file is for.


Create an A record for the base domain, example.com. Also, create an A record for ns.example.com, the name server in this example:


;

; BIND data file for example.com

;

$TTL 604800

@ IN SOA example.com. root.example.com. (

2 ; Serial

604800 ; Refresh

86400 ; Retry

2419200 ; Expire

604800 ) ; Negative Cache TTL

IN A 192.168.1.10

;

@ IN NS ns.example.com.

@ IN A 192.168.1.10



@

IN

AAAA

::1

ns

IN

A

192.168.1.10

You must increment the Serial Number every time you make changes to the zone file. If you make multiple changes before restarting BIND9, simply increment the Serial once.


Now, you can add DNS records to the bottom of the zone file. See Section 4.1, “Common Record Types” [p. 178] for details.


Many admins like to use the last date edited as the serial of a zone, such as 2012010100 which is yyyymmddss (where ss is the Serial Number)


Once you have made changes to the zone file BIND9 needs to be restarted for the changes to take effect:


sudo systemctl restart bind9.service


Top OS Cloud Computing at OnWorks: