• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

Understanding DNS zone files

by admin

What are DNS zone files

Information about domains in the DNS database is stored in zone files. A zone file consists of directives and resource records. Directives tell the nameserver to perform tasks or apply special settings to the zone. Resource records define the parameters of the zone and store host information. Directives are optional, but resource records are required.

Resource record fields

A resource record has the following fields (some fields are optional, depending on the Type):

  • Name: The domain name or IP address
  • TTL: Time to live, maximum time a record is cached before checking for a newer one
  • Class: Always IN for Internet
  • Type: Record type
  • Data: Varies with record type

Most commonly used DNS resource record types

More than 30 types of resource records exist. The more common ones are:

  • A: IPv4 address
  • CNAME: Canonical name or alias
  • MX: Mail exchange, specifies the destination for mail addressed to the domain
  • NS: Nameserver, specifies the system that provides DNS records for the domain
  • PTR: Maps an IP address to a domain name for reverse name resolution
  • SOA: Start of authority, designates the start of a zone

The following is an example of a zone file /etc/named.conf:

$TTL 86400      ; 1 day
    example.com IN SOA dns.example.com. root@example.com. (
                       57         ; serial
                       28800      ; refresh (8 hours)
                       7200       ; retry (2 hours)
                       2419200    ; expire (4 weeks)
                       86400      ; minimum (1 day)
                       )
                IN NS dns.example.com.
    dns           IN         A        192.0.2.1       
	example.com   IN         A        192.0.2.1
	host01        IN         A        192.0.2.101
	host02        IN         A        192.0.2.102
	host03        IN         A        192.0.2.103

The $TTL entry is a directive that defines the default time to live for all resource records in the zone. Each resource record can have a TTL value, which overrides this global directive.

The next line in the example is the SOA record. All zone files must have one SOA record. The following information is included in the SOA record:

  • example.com: The name of the domain
  • dns.example.com.: The FQDN of the nameserver
  • root@example.com.: The email address of the user who is responsible for the zone
  • serial: A numerical value that is incremented each time the zone file is altered to indicate when it is time for the named service to reload the zone
  • refresh: The elapsed time after which the primary nameserver notifies secondary nameservers to refresh their database
  • retry: The time to wait after which a refresh fails before trying to refresh again
  • expire: The time after which the zone is no longer authoritative and the root nameservers must be queried
  • minimum: The amount of that time that other nameservers cache the zone’s information.

The NS (Nameserver) record announces authoritative nameservers for a particular zone by
using the format:

IN NS dns.example.com.

The A (Address) records specify the IP address to be assigned to a name by using the format:

hostname IN A IP-address

Filed Under: CentOS/RHEL 6, CentOS/RHEL 7, Linux

Some more articles you might also be interested in …

  1. How to list or install only security updates with dnf in CentOS/RHEL 8
  2. RHEL 7 – RHCSA Notes – Set enforcing and permissive modes for SELinux
  3. How to Remove Network Printer in CentOS/RHEL
  4. CentOS / RHEL 7 : Never run the iptables service and FirewallD service at the same time!
  5. Hostname change not reflecting in sar report for CentOS/RHEL
  6. How to Use the ssh-keygen Command to configure passwordless ssh
  7. pinky Command Examples in Linux
  8. Connection using SSH to a Host Not in DNS/hosts Stalls for Some Time at Connection Initiation
  9. ‘ulimit: max user processes: cannot modify limit:operation not permitted’ Shown When Login
  10. Getting “parsing errors” When Running ‘yum repolist’

You May Also Like

Primary Sidebar

Recent Posts

  • vgextend Command Examples in Linux
  • setpci command – configure PCI device
  • db_load command – generate db database
  • bsdtar command – Read and write tape archive files

© 2022 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright