Setting up a local domain

In order for us to host our own local domain, we will be required to create a forward zone file as well as update or create a reverse zone file.

Forward zone file

The forward zone file contains the mappings of host names to IP addresses. Below is an example of a forward zone file.

;
; BIND forward data file for mydomain.local zone
;
$TTL    86400
@	IN	SOA	ns.mydomain.local.	non-existant.mydomain.local. (
				         1	; Serial
				    604800	; Refresh
				     86400	; Retry
				   2419200	; Expire
				     86400 )	; Negative Cache TTL
	IN	NS	ns
	IN	MX 10	mail
;
@		IN	A	192.168.100.10
gw		IN	A	192.168.100.1
myhost		IN	A	192.168.100.10
ns		IN	CNAME	myhost
mail		IN	CNAME	myhost

For the definition above, the value for Serial contains the value of the current definition – when updating the zone file, this value should be updated to ensure that it refreshes across all DNS servers and the correct definition is loaded. The values for Refresh, Retry, Expire and Negative Cache TTL are all values in seconds that specifies the time to perform the operations.

The line IN NS defines the hostname of the DNS server.

The line IN MX defines the hostname of the mail server.

The line @ IN A 192.168.100.10 defines the IP address that would be returned when performing a DNS lookup on the mydomain.local domain.

The line myhost IN A 192.168.100.10 defines the IP address that would be returned when performing a DNS lookup on the myhost.mydomain.local host name. All IN A records define the mappings between the host name and their respective IP addresses.

The line ns IN CNAME myhost defines that the hostname ns is a virtual name for myhost. All IN CNAME records define the mappings between the virtual names and their respective host names.

Reverse zone file

The reverse zone file contains the mappings of IP addresses to host names.

;
; BIND reverse data file for 192.168.100 zone
;
$TTL    86400
@	IN	SOA	localhost.	root.localhost. (
			         1	; Serial
			    604800	; Refresh
			     86400	; Retry
			   2419200	; Expire
			     86400 )	; Negative Cache TTL
	IN	NS	ns.mydomain.local.
;
1	IN	PTR	gw.mydomain.local.
10      IN      PTR     myhost.mydomain.local.

For the definition above, the value for Serial contains the value of the current definition – when updating the zone file, this value should be updated to ensure that it refreshes across all DNS servers and the correct definition is loaded. The values for Refresh, Retry, Expire and Negative Cache TTL are all values in seconds that specifies the time to perform the operations.

The line IN NS defines the hostname of the DNS server.

The line IN PTR defines the mapping between the IP address and the fully qualified host name.

Adding the zone definition

Once the zone files have been created and/or updated, the /etc/bind/zones.local file should be updated to include references to the zone files, as shown below.

zone "100.168.192.in-addr.arpa" { type master; file "/etc/bind/zones/db.192.168.100"; };
zone "mydomain.local" { type master; file "/etc/bind/zones/db.mydomain.local"; };
Advertisements

One thought on “Setting up a local domain

Comments are closed.