Domain Name System (DNS) zone files
A DNS zone file is a text database file that describes a portion of the domain name system (DNS) called a DNS zone. A zone contains mappings between domain names and IP addresses and other resources, organized in form of resource records (RR).
There are different types of DNS Resource Records (RRs). The most common types of Resource Records (RRs) are listed below.
"A" (Address) type Resource Record
An "A" (Address) type Resource Record is an "IPv4 host record" and it is the most common type. An "A" type is simply a static mapping of a hostname to an IPv4 address.
"AAAA" (IPv6 Address) type Resource Record
An "AAAA" (IPv6 Address) type Resource Record is an "IPv6 host record", which is used to map a host name to an IPv6 address.
"MX" (Mail eXchanger) Resource Record
An "MX" (Mail eXchanger) Resource Record is specifically for mail servers. It's a special type of service-specifier record. It identifies a mail server for the domain.
"CNAME" (Canonical Name) Resource Record
A "CNAME" (Canonical Name) Resource Record is an alias record. By creating a CNAME record, we can make the same physical server respond to two different hostnames.
"PTR" (Pointer) type Resource Record
A "PTR" (Pointer) type Resource Record resolve IP addresses into hostnames.
"NS" (Name Server) record
"NS" (Name Server) records specify the authoritative DNS servers for a domain.
"SOA" (Start Of Authority) record
"SOA" (Start Of Authority) record is the first record in the zone file. An "SOA" record is only present in a zone file located on authoritative DNS servers. "SOA" (Start Of Authority) specifies
• The primary authoritative DNS server for the zone (domain).
• The e-mail address of the zone's (domain's) administrator.
• Timing related information to the secondary DNS servers like refresh or expire interval, serial number to indicate the version of the zone file etc.
A sample forward lookup zone directive and forward lookup zone file is copied below. You can see the different Resource Records (RRs) like SOA, NS, A, and CNAME in the zone file.
Sample forward lookup zone directive in /etc/named.conf file
zone "omnisecu.com" IN {
type master;
file "omnisecu.com.zone.db";
allow-query { 192.168.1.0/24; };
};
Corresponding forward lookup zone file
$ORIGIN . $TTL 86400 ; 1 day omnisecu.com IN SOA RHEL04.omnisecu.com. admin.omnisecu.com. ( 2009072845 ; serial 10800 ; refresh (3 hours) 900 ; retry (15 minutes) 604800 ; expire (1 week) 86400 ; minimum (1 day) ) NS RHEL04.omnisecu.com. NS RHEL05.omnisecu.com. $ORIGIN omnisecu.com. ftp CNAME RHEL04.omnisecu.com RHEL04 A 192.168.1.104 RHEL05 A 192.168.1.105 RHEL06 A 192.168.1.106 www A 192.168.1.104
A sample reverse lookup zone directive in /etc/named.conf file and corresponding reverse lookup zone file is copied below.
Sample reverse lookup zone directive in /etc/named.conf file
zone "1.168.192.in-addr.arpa" IN {
type master;
file "1.168.192.in-addr.arpa";
allow-update { none; };
};
Corresponding reverse lookup zone file
$TTL 86400 @ IN SOA RHEL04.omnisecu.com. root.RHEL04.omnisecu.com.( 2009072852 ; Serial 28800 ; Refresh 14400 ; Retry 3600000 ; Expire 86400 ) ; Minimum IN NS RHEL04.omnisecu.com. 104 IN PTR RHEL04.omnisecu.com. 105 IN PTR RHEL05.omnisecu.com. 106 IN PTR RHEL06.omnisecu.com.