The DNS Zone File helps to translate domain names into IP addresses. Let’s talk something about DNS Zone File in this series of article. Although this series of DNS Zone File articles were written in year 2000, most information should still be valid for many years.

Page 1: DNS and Name Servers Revision

As we learned in the Domain Name System (DNS) tutorials, human being like the easy-to-remember domain name (for example, MyGreatname.com) and don’t like the hard-to-remember IP address (for example, 192.168.1.23). However computer need to use IP addresses to communicate with each other.

The DNS Zone File helps to translate domain names into IP addresses. What is DNS Zone File? Let’s talk about DNS Zone File in this series of article.

I already talked the following two topics in earlier article series:

  • IP Address, and
  • How DNS Works

We should have some basic knowledge of Domain Name System and Domain Name Server.

This article series try to introduce how Name Server and DNS Zone Files work. If you wish to register domain names and wish to know why two nameservers are required and how the nameservers work, please read on.

Revision of DNS

Let’s review the duties of Domain Name System and Domain Name Servers on the Internet:

  • The duty of Domain Name System is to translate domain names (for human communication) into IP addresses (for computer communication).
  • Name Servers are simply computers that can handle DNS Query. They can translate domain names into IP address.
  • Each registered domain name must provide at least two nameservers.
  • When a new domain is registered (e.g. MyGreatName.com) on the Internet, interNIC will add the nameservers information of this domain into the database of root nameservers

Page 2: Domain Name Registration Process Revision

Let’s go through briefly again the whole process of domain name registration.

  1. Assume you register a new domain name through a domain reseller.
  2. The domain reseller will login his Registrar website to register the new domain. The information require to register a new domain:
    * Domain Name
    * Domain owner, for example, name, address, etc…
    * Information of two name servers (Primary and secondary nameservers) Note:
    At least two nameservers are required for each domain name. – One is Primary Name Server (Example : ns1.NameServer.com)
    – The other is Secondary Name Server (Example : ns2.NameServer.com)
  3. The domain reseller register the new domain through the system of Registrar. Actually The Registrar system is also connecting with the network of interNIC.
  4. While the domain is registered, the system of interNIC will add the record of the new domain into the domain database (whois). Once the information of the new domain has been added into the whois database, nobody can register the same domain.
  5. Then, interNIC will also add the nameservers information of the new domain into the database of a root nameserver.
  6. Then the information of the new domain will be passed from one root nameserver to other root nameservers. This process is called Propagation.
  7. Once the information of a new domain has been added to the databases of root nameservers, the new domain becomes live (Activate) on the Internet.

The whole process of new domain registration can be illustrated in the diagram below:

Page 3: How DNS works Revision

Let’s go through breifly the working procedures of DNS:

  1. Suppose you are going to browse YourDomain.com
  2. Your computer will send a request to the default Domain Name Server (usually the DNS of your ISP), asking for the IP address of YourDomain.com.
  3. If the default Domain Name Server has the IP address information of YourDomain.com, she will tell the IP address of YourDomain.com to your computer.
  4. Let’s assume a bad scenario here. The default Domain Name Server do not has the IP address information of YourDomain.com.
  5. In this situation, the ISP Domain Name Server will check her own named.cache file, find out the IP address of Root Domain Name Server. She will then send request to one of the Root Name Server, asking for the IP address of YourDomain.com.
  6. In case, the first Root Domain Name Server is out of order, she will check the named.cache file again, and send request to the second Root Domain Name Server……..
  7. If Root Domain Name Server has the nameservers information of YourDomain.com, she will tell the nameservers IP address of YourDomain.com to ISP Domain Name Server.
  8. When ISP Domain Name Server has the nameservers IP address of YourDomain.com, she can them send a request to the nameservers, asking for the IP address of YourDomain.com.
  9. The nameservers of YourDomain.com receive the request from ISP Domain Name Server.
  10. The nameservers of YourDomain.com check the file, finding the IP address of YourDomain.com. Then tell the IP address of YourDomain.com to ISP Domain Name Server.
  11. The ISP Domain Name Server then tell the IP address of YourDomain.com to your computer.
  12. Your computer has the IP address of YourDomain.com. Then your computer can then communicate with the computer of YourDomain.com

The whole DNS process can be illustrated with the following diagram:

Page 4: Primary and Secondary Name Server

Each domain requires the information of at least two name servers.

The Domain Nameserver will usually set one of the nameserver as Primary Name Server. While the other is set as a Secondary Name Server. In fact the Secondary Name Server is server as a backup.

Actually there is no any difference between Primary Name Server and Secondary Name Server. However the name of Primary Name Server will appear before the Secondary Name Server in the DNS Zone File.

Take the following DNS Zone File as an example:

In this example:

  • ns1.ServerName.com is the Primary Name Server, and
  • ns2.ServerName.com is the Secondary Name Server

However if we changed the DNS Zone File as follow:

Then:

  • ns2.ServerName.com is the Primary Name Server, and
  • ns1.ServerName.com is the Secondary Name Server

We will discuss DNS Zone File in more details in next section of this tutorial series.

Page 5: What is DNS Zone File

We mentioned in previous chaper that the information of nameservers of domain names are saved in the DNS Zone File. Let’s discuss in more details about DNS Zone File.

Each domain in a Domain Name Server has it’s own record file. This file is usually called DNS Zone File.

The following diagram shown the DNS Zone Files of a Name Server:

The record file of a domain contains some records. Each record is usually called Resource Record or RR for short. The Resource Records decide the structure of a domain. Can’t follow? Don’t worry. In short, Resource Records can change the domain names into IP addresses.

Resource Records can have a lot of format. However the commonly used format are shown as follow:

We will discuss the structure of DNS Zone File in next section of this tutorial series.

Page 6: Structure of DNS Zone File

From previous chapter of DNS Zone File tutorial, we mentioned that:

  • Each domain in a Domain Name Server has it’s own record file. This file is usually called DNS Zone File.
  • The record file of a domain contains some records. Each record is usually called Resource Record, or RR for short.

A DNS Zone File can have a lot of different Resource Records. However the following four Resource Records are most commonly used in a DNS Zone File:

For most domain names, the above four types of Resource Records (DNS SOA Record, DNS NS Record, DNS A Record and DNS MX Record) are usually enough for DNS configuration. We will discuss the four Resource Records one by one in coming sections of this DNS Zone File tutorial series.

Page 7: DNS SOA Resource Record

The first record in a DNS Zone File is the SOA (Start Of Authorization) Resource Record. There is only one SOA Resource Record allowed in a DNS Zone File.

In short, the SOA Resource Record indicate the start of DNS Zone File.

Main Information of SOA Resource Record

The main information of SOA Record are usually:

  • Name of Domain Name Server, and
  • Email address of responsible person of Domain Name Server

The general format of SOA Resource Record is shown in the diagram below:

In addition to the above main information, some general setting of Domain Name Server can also be included in SOA Resource Record. There are a lot of setting of Domain Name server. However only some important setting will be included in the SOA Record. We discuss four important setting of Domain Name Server in this tutorial. They are:

  • Serial
  • Refresh
  • Retry
  • TTL (Time To Life)

The following example is a rather complete SOA Resource Record:

Serial

The serial data is used to record down the changes of DNS Zone File. Whenever the record of DNS Zone File update for one, the Serial data will be increased by one.

Take the above Serial (200105508) as an example. The Serial has been set for the Year (2001), the Month (05) and the number of update in that month (508). When there is an update for the DNS Zone File, the serial will become 200105509, and the next update will then be 200105510, etc….

Of course you can set the serial start from zero. Whenever there is an update, the serial number will be increased by one.

The Secondary Name Server will regularly check and compare with the information of Primary Name Server. When she find the Serial number of her own SOA Resource Record is different from the Primary Name Server, she will know immediately that the information of the Primary Name Server has been changed. Therefore the Secondary Name Server will update her records accordingly.

Refresh

The value of Refresh is represent by seconds. In the above example, the Refresh time is 10080 seconds (or 3 hours)

This is the setting that how long the Secondary Name Server will check and compare with the information of Primary Name Server. This is used to check if there is any changes of information of the Primary Name Server.

Retry

The value of Retry is also represent by seconds. In the above example, the Retry time is 3600 seconds (or 1 hour).

This is the setting that when the Secondary Name Server fail to connect with the Primary Name Server, how long it will try to connect again.

TTL

The full name of TTL is Time To Live. You can also think of “Time To Survive”. The value of TTL is also represent by seconds. In the above example, the TTL is 86400 seconds (or 24 hours).

As we learned from the DNS tutorial. When the default Domain Name Server do not has the IP address information of query domain name (e.g. YourDomain.com), she will ask other Domain Name Server for assistance and reply the answer to your computer. The default Domain Name Server will then save the query result into her Cache memory for a period of time before discard. This period of time is called Time To Live (TTL). This is best explained with the diagram below:

You may wonder why the Domain Name Server save the query result into her Cache memory for a period of time before discard?

The reason is very simple. Because the same domain query may happen again. If this really happens, the Domain Name Server do not need to ask and bother other Domain Name Server again. She can get the result from her Cache Memory and reply the query promptly. This can increase the query efficiency greatly, as shown in the diagram below:

Remember that the information will only save in the Cache Memory for the set TTL time.

You may also ask. If this can increase the query efficiency, why not save the information in the Cache Memory longer? For example, one or two months, or even one year!

The reason is very simple. Because when the information of the domain name is changed, and the information saved in the Cache Memory is out of date. In this situation, the domain name will be lost. This explain why your domain name may be lost for some time after you changed the information. This situation is illustrated in the diagram below:

This is the end of DNS SOA Resource Record.

Page 8: DNS NS Resource Record

Domain Server (NS) Record identify the DNS servers responsible for the domain name. The following is a typical example of NS Record:

; Name Server (NS) Records
YourDomain.com.   IN   NS   ns1.NameServer.com.
YourDomain.com.   IN   NS   ns2.NameServer.com.

In this example, YourDomain.com use two Domain Name Servers to save it’s information:

  • The first Name Server(Primary Nameserver) is ns1.NameServer.com
  • The second Name Server (Secondary Nameserver) is ns2.NameServer.com

We will discuss the DNS ‘A’ Resource Record in next article. The ‘A’ record should be the most important record type of DNS Zone File.

Page 9: DNS A Resource Record

The A Resource Record is the most important record type of DNS. The A Record translate domain name into IP address. This record provide the corresponding IP address of each computer (host) on the Internet. When your computer get the IP address of a host, then they can communicate with each others.

The following is an example of A Record:

; A Record 			
www.YourDomain.com. 	IN 	A 	123.120.110.1
YourDomain.com. 	IN 	A 	123.120.110.1
mail1.YourDomain.com. 	IN 	A 	123.120.110.2
mail2.YourDomain.com. 	IN 	A 	123.120.110.3
ns1.NameServer.com. 	IN 	A 	123.120.110.10
ns2.NameServer.com. 	IN 	A 	123.120.110.11

Let’s explain the above A Records one by one.

www.YourDomain.com IN A 123.120.110.1

This line specify the IP address of the server of YourDomain.com is 123.120.110.1.

When your computer send request to the above Nameserver, asking for the IP address of YourDomain.com. The Nameserver will answer the IP address (123.120.110.1) of YourDomain.com to your computer. When your computer get the IP address of YourDomain.com (123.110.110.1), your computer can then connect with and communicate with the host server (123.110.110.1) of YourDomain.com.

YourDomain.com IN A 123.120.110.1

The meaning of this line is same as the first line. With this line, you can use http://YourDomain.com or http://www.YourDomain.com to browse the website of YourDomain.com.

There are many domains on the Internet without this line therefore they can only be access with http://www.xxxxxxx.com.

mail1.YourDomain.com IN A 123.120.110.2
mail2.YourDomain.com IN A 123.120.110.3

These two lines states:

YourDomain.com use two Mail servers to handle emails:

  • mail1.YourDomain.com server (Mail Server) with IP 123.120.110.2.
  • mail2.YourDomain.com server (Mail Server) with IP 123.120.110.3.

However only these two lines cannot receive emails sending to @YourDomain.com. They must configure with the MX Records discuss in the next chapter.

ns1.NameServer.com. IN A 123.120.110.10

This is the IP address of Primary Name Server that save the DNS Zone File of YourDomain.com.

ns2.NameServer.com. IN A 123.120.110.11

This is the IP address of Secondary Name Server that save the DNS Zone File of YourDomain.com.

Page 10: DNS MX Resource Record

A MX (Mail Exchange) Resource Record uses to specify the mail server responsible for a domain name. If your domain do not has mail server or do not need email service, this MX Resource Record can be omitted.

The following is a typical example of using MX Resource Record. The domain (YourDomain.com) uses two mail servers (mail.YourDomain.com and mail2.YourDomain.com) to handle emails.

; MX Record 			
YourDomain.com. 	IN 	MX 0 	mail1.YourDomain.com
YourDomain.com. 	IN 	MX 10 	mail2.YourDomain.com

A domain can have many MX Records. The conditions are:

  • If one mail server is used, one MX Resource Record is required.
  • If two mail servers are used, two MX Resource Records are required.
  • If five mail servers are used, five MX Resource Records are required.

Please noted that there is a number after the MX Resource Record. This number is called Preference Number. You can use any integer, for example, 0, 5, 10, 20, 100…. etc, for the Preference Number.

What is the purpose of Preference Number for a MX Record? The Preference Numbers determine the order (lower numbers first) the mail servers should be used, with the smallest number has the highest priority. Usually no same Preference Numbers should be used for the MX Records of a same domain.

Suppose you are going to send an email to xxxx@YourDomain.com. The following are simplified procedures:

  1. Your ISP SMTP mail server send an request for the MX Records of YourDomain.com.
  2. Your ISP SMTP mail server get the address of mail server of Your Domain.com.
  3. Your ISP SMTP mail server contact the mail server with the highest priority. In the above example, mail1.YourDomain.com will be contacted.
  4. If the first mail server cannot be contacted successfully, the mail server with the second priority will be contacted, for example, mail2.YourDomain.com.

We will use a typical, simple and practical example of a DNS Zone File to conclude this series of tutorial in next section.

Page 11: Typical example of DNS Zone File

Let’s use a typical, simple and practical example of a DNS Zone File to conclude this series of DNS Zone File tutorials.

The main character of this example is YourDomain.com. The following is the DNS Zone File of YourDomain.com:

This is the end of How DNS Zone File Works tutorial series.