DNS Records 101

There is usually a lot of confusion about what each DNS record will do. Or how are they supposed to help you. This lesson was designed to better explain how to properly configure your domain to work properly.

Topics covered in this lesson:


A Record (Address Record)

Each of these records map a name to an IP address.

Example:

Name
TTL
Type
IP
www.jacsoft.co.nz. 10800 A 192.168.1.2
  • Name - The www.jacsoft.co.nz is the host.
  • TTL (time to live) - The 10800 indicates how often (in seconds) that this record will exist (will be cached) in other systems. The lower the number the more frequent systems will go to the DNS server for queries.
  • IP - 192.168.1.2 indicates the IP which this host will go to.
You are allowed multiple IPs per host for routing using "round robin" functionality. So the following is also valid:
Name
TTL
Type
IP
www.jacsoft.co.nz. 10800 A 192.168.1.2
www.jacsoft.co.nz. 10800 A 10.2.54.4

NOTE: It is important to know that only an A record can be made for your root host record. If you have a domain called example.com. and if you want an IP for example.com. then A record is the only valid solution for this. CNAME records are invalid.

Back to Top


Wildcard Record

Wildcard Records give you the ability to map all (or a section) of the records in your domain to one IP. All Wildcard records are created with A records.

If you create a record that is part of your domain (and inclusive of the wild card set) then only that record is directed to the other IP and everything else will goto the Wildcard record.

Example:


Name
TTL
Type
IP
*.jacsoft.co.nz. 10800 A 192.168.1.2
www.jacsoft.co.nz. 10800 A 10.2.54.4

The 'www' record would goto 10.2.54.4 but all of the other IPs would goto 192.168.1.2

Back to Top


Load Balancing / Round Robin

Load balancing / Round Robin allows you to distribute your server load evenly among multiple servers.

All you have to do is create multiple A records with the same name but with a different IP / value.

Example:
Name
TTL
Type
IP
www.example.com. 10800 A 192.168.1.2
www.example.com. 10800 A 10.2.54.4

50% of the time a user would go to 192.168.1.2 and 50% of the time the users would go to 10.2.54.4.

You can even split the traffic to more hosts. For example:

  • If you have three (3) A records with the same name the traffic would be split evenly (33.333% to each host)
  • If you have four (4) A records with the same name the traffic would be split evenly (25% to each host).
  • etc.

NOTE: There is generally a limit of (thirteen) 13 hosts that you can round robined (13 A records with the same name and different values) due to the limitations of the UDP packet which is what the DNS protocol generally runs over.

Back to Top


CNAME Record (Canonical Name Record)

These are usually referred to as alias records since they usually map an alias to its canonical name. The name server does handle these queries differently from an A record. When a name server looks up a name and finds a CNAME record, it replaces the name with the canonical name and looks up the new name. This allows you to point multiple systems to one IP without specifically assigning an A record to each host name. If your IP was ever to change you would only have to change one A record.

Example:

Name
TTL
Type
Data
www.jacsoft.co.nz. 10800 A 192.168.1.2
ftp.jacsoft.co.nz. 10800 CNAME www.jacsoft.co.nz.
  • The A record is similar to the example above. Please read the section on A Records if this does not make sense to you.
  • Name - ftp.jacsoft.co.nz is the host which are we are making an alias for.
  • TTL (time to live) - The 10800 indicates how often (in seconds) that this record will exist (will be cached) in other systems. The lower the number the more frequent systems will go to the DNS server for queries.
  • Data - www.jacsoft.co.nz is the host which ftp.jacsoft.co.nz is an alias to. It is important to realize that this value is never a CNAME value. This value should primarily be A record but could use an IP.

When the DNS server is queried for the ftp.jacsoft.co.nz. system it realizes that it is an alias for www.jacsoft.co.nz.. The system then returns the value of www.jacsoft.co.nz.. which is 192.168.1.2. Whatever www.jacsoft.co.nz. points to then so does ftp.jacsoft.co.nz..

You can also use CNAME to point a record in one zone to a record in another zone. The following is valid:

Name
Expire Time
TYPE
Data / Value (A Record)
www.jacsoft.co.nz. 10800 CNAME www.tiggee.com.

NOTE: It is important that CNAME always are to the left hand side. You should never make an alias to an alias. Or you should never use MX or NS records with CNAME records. You can read more about NS and MX records later in this document.

NOTE: It is important to know that only an A record can be made for your root host record. If you have a domain called example.com. and if you want an IP for example.com. then A record is the only valid solution for this. CNAME records are invalid.

Back to Top


NS Record (Name Server Record)

These records indicate which name servers are authoritative for the zone.

Example:

Name
TTL
Type
Data
ns.jacsoft.co.nz. 10800 A 192.168.10.12
jacsoft.co.nz. 10800 NS ns.jacsoft.co.nz
  • The A record is similar to the example above. Please read the section on A Records if this does not make sense to you.
  • Name - jacsoft.co.nz. is the domain which is being assigned an authoritative name server.
  • TTL (time to live) - The 10800 indicates the how often (in seconds) that this record will exist (will be cached) in other systems. The lower the number the more frequent systems will go to the DNS server for queries.
  • Data - ns.jacsoft.co.nz. is the host which name servers will query for records in the jacsoft.co.nz.. domain. It is important to realize that this value is never a CNAME value. This value should primarily be A record but could use an IP.

You can also use NS records to assign the authoritative name server for a subdomain.

Example:

Name
TTL
Type
Data (A Record)
sub.jacsoft.co.nz. 10800 NS ns1.jacsoft.co.nz.

Name servers will query ns1.jacsoft.co.nz. for records in the sub.jacsoft.co.nz. sub-domain

Back to Top


MX Record (Mail Exchange Record)

These records tell mail servers where to deliver mail. The name field of an MX record contains the host name which appears in the e-mail address, and the data field contains the hostname of the server to which the mail should be delivered. Two MX records that define the mail servers for the jacsoft.co.nz domain might contain the following:

Name
Expire Time
Type
MX level
Data (A Record)
jacsoft.co.nz. 10800 MX 10 mail.jacsoft.co.nz.
jacsoft.co.nz. 10800 MX 20 backupmail.jacsoft.co.nz.
  • Name - Contains the domain jacsoft.co.nz., meaning that these records are used for the entire domain. If the mail was addressed to username@jacsoft.co.nz, the mail is directed to the mail exchangers defined by these records.
  • TTL (time to live) - The 10800 indicates the how often (in seconds) that this record will exist (will be cached) in other systems.
  • MX level - Sets the preference for the MX record. The mailserver will first try mail.jacsoft.co.nz.. The lower the number the higher the preference. If the mail server with highest precedence is inaccessible the mail will be delivered to the mail server next in precedence. So if the server mail.jacsoft.co.nz. is unavailable then backupmail.jacsoft.co.nz. will get mail to be queued until mail.jacsoft.co.nz. is ready to accept mail again. At that time backupmail.jacsoft.co.nz will send it's queued mail to mail.jacsoft.co.nz. Note: The email server must also be configured properly to queue mail for another system
  • Data - The host names which will have mail delivered to them for the domain. It is important to realize that this value is never a CNAME value. This value should primarily be A record but could use an IP.

Back to Top


TXT Record (Text Record)

These records are simply a list of strings, each less than 256 characters in length. TXT records can be used for anything you want.

Example Input for Domain Name: example.com
Name: mail
Data (TXT): This is the main mail server.
TTL: 1800 seconds

Result:
This will create a TXT record for the 'mail.example.com.' record and the description (text) of the record will be "This is the mail mail server.".

 

Back to Top


PTR Record (Pointer Record)

Pointer records are used to map a network interface (IP) to a host name. These are primarily used for reverse DNS.

Example Input for Domain Name: 1.168.192.in-addr.arpa
Name: 25
Data (PTR to): www.example.com.
TTL: 1800 seconds

Result:
This will create a reverse DNS entry for 192.168.1.25. The reverse DNS will be a pointer to 'www.example.com.'. This record will have a cache (TTL) of 30 minutes.