Oracle Cloud Infrastructure Documentation

How to Format a Zone File

A zone file is a text file that describes a DNS zone. The BIND file format is the industry preferred zone file format and has been widely adopted by DNS server software. The format is defined in RFC 1035.

Example an OCI Zone File

This an example of a zone file downloaded from OCI's DNS service.

			@                    3600 SOA (     ; address of responsible party
			2016072701                 ; serial number
			3600                       ; refresh period
			600                        ; retry period
			604800                     ; expire time
			1800                     ) ; minimum ttl
			86400 NS
			86400 NS
			86400 NS
			86400 NS
			3600 MX    10
			3600 MX    20
			3600 MX    30
			60 A
			3600 TXT   "v=spf1 ~all"
			mail                  14400 A
			vpn                      60 A
			webapp                   60 A
			webapp                   60 A
		www                   43200 CNAME



Record Classes

In the example zone file above, no record classes (IN, CH, HS) are displayed. OCI’s DNS service only works with Internet (IN) class records but omits the class information in zone files for efficiency purposes.

Anatomy of a Zone File

$ORIGIN indicates a DNS node tree and will typically start a DNS zone file. Any host labels below the origin will append the origin hostname to assemble a fully qualified hostname. Any host label within a record that uses a fully qualified domain terminating with an ending period will not append the origin hostname.

Example: With $ORIGIN, any record where the host label field is not followed by a period, will be appended to them.

The “@” symbol is a special label that indicates the $ORIGIN should replace the “@” symbol. This is typically used for the apex of a zone.

SOA Record – The $ORIGIN is followed by the zone’s Start Of Authority (SOA) record. An SOA record is required for each zone. It contains the name of the zone, the e-mail address of the party responsible for administering the domain’s zone file, the current serial number of the zone, the primary nameserver of the zone, and various timing elements (measured in seconds).

SOA Record Format

@     IN     SOA    {primary-name-server}     {hostmaster-email} (
			{minimum-TTL} )
  • Primary Name Server – The nameserver that contains the original zone file and not an AXFR transferred copy.
  • Hostmaster Email – Address of the party responsible for the zone. A period “.” is used in place of an “@” symbol. For email addresses that contain a period, this will be escaped with a slash “/”.
  • Serial Number – Version number of the zone. The serial number will increase with each subsequent update to your zone.
  • Time To Refresh – How long a nameserver should wait prior to checking for a serial number increase within the primary zone file, in seconds. An increased serial number detected by a secondary DNS nameserver means a transfer is needed to sync your records. Only applies to zones using secondary DNS.
  • Time To Retry – How long a nameserver should wait prior to retrying to update a zone after a failed attempt, in seconds. Only applies to zones using secondary DNS.
  • Time To Expire – How long a nameserver should wait prior to considering data from a secondary zone invalid and stop answering queries for that zone, in seconds. Only applies to zones using secondary DNS.
  • Minimum TTL – Minimum Time To Live (TTL). How long a nameserver or resolver should cache a negative response, in seconds.

Anatomy Of A Record Within A Zone File

A zone file is a collection of resource records with each record entry described in the following sequence:

Format: Host Label TTL Record Class Record Type Record Data
Example: 60 IN A

  • Host Label – A host label helps to define the hostname of a record and whether the $ORIGIN hostname will be appended to the label. Fully qualified hostnames terminated by a period will not append the origin.
  • TTL – The Time To LIve (TTL) is the amount of time that a DNS record will be cached by an outside DNS server or resolver, in seconds.
  • Record Class – There are three classes of DNS records: IN (Internet), CH (Chaosnet), and HS (Hesiod). OCI DNS only uses the IN class of records.
  • Record Type – Where the format of a record is defined.
  • Record Data – The data within a DNS answer, such as an IP address, hostname, or other information. Different record types will contain different types of record data.