Understanding the DNS zone

From Amen Wiki

Jump to: navigation, search

Contents

[edit] Introduction

We have been setting up our domain from the control panel and it ended up looking up like this:

* 195.8.78.1
Generic record: value for all undefined subdomains
AMEN http://www.amenworld.com
redirection server
AWSTATS 195.8.78.1
FTP 195.8.78.1
FTP server. This is usually the same as your web server
IMAP 80.168.46.11
JOOMLA 195.8.78.1
Add-On web server
MAIL 80.168.46.11
email control panel
MAMBO 195.8.78.1
Add-On web server
MX1 80.168.44.11
the server that receives your emails
MX2 mail.anotherdomain.co.uk
backup server that receives your mail
MX30 80.168.66.11
backup server that receives your mail
POP3 80.168.46.11
backup server that receives your mail
SMTP 80.168.45.11
outgoing mail server
TESTALIAS www.domain.co.uk
TESTIP 62.193.23.36
TESTWEBREDIR http://www.domain.co.uk
redirection server
WEBMAIL 80.168.46.11
WWW 195.8.78.1
web server

Some of the records are created by the system and respond to standard functionality that your pack contains. They will be highlighted to avoid accidental deletion:

DNS RECORD Default records created by the system that cannot be deleted.
ADD-ON These records correspond to installed Add-Ons and cannot be modified or deleted. The record will be deleted when the Add-on is uninstalled.
OPTION These records correspond to optional services and cannot be modified or deleted. The record will be deleted when the optional service is uninstalled.

The zone that would be generated from the table above would be:

RECORD				TTL	CLASS	TYPE	VALUE
domain.co.uk.			7200	IN	NS	ns1.amenworld.com.
domain.co.uk.			7200	IN	NS	ns2.amenworld.com.
*.domain.co.uk.			7200	IN	A	195.8.78.1
amen.domain.co.uk.		7200	IN	A	62.193.206.144
awstats.domain.co.uk.		7200	IN	A	195.8.78.1
ftp.domain.co.uk.		7200	IN	A	195.8.78.1
imap.domain.co.uk.		7200	IN	A	80.168.46.11
joomla.domain.co.uk.		7200	IN	A	195.8.78.1
mail.domain.co.uk.		7200	IN	A	80.168.46.11
mambo.domain.co.uk.		7200	IN	A	195.8.78.1
mx1.domain.co.uk.		7200	IN	A	80.168.44.11
mx2.domain.co.uk.		7200	IN	CNAME	mail.anotherdomain.co.uk.
mx30.domain.co.uk.		7200	IN	A	80.168.46.11
domain.co.uk.			7200	IN	MX	10 mx1.domain.co.uk.
domain.co.uk.			7200	IN	MX	20 mail.anotherdomain.co.uk.
domain.co.uk.			7200	IN	MX	30 mx30.domain.co.uk.
pop3.domain.co.uk.		7200	IN	A	80.168.46.11
smtp.domain.co.uk.		7200	IN	A	80.168.45.11
testalias.domain.co.uk. 	7200	IN	CNAME	www.domain.co.uk.
testip.domain.co.uk.		7200	IN	A	62.193.23.36
testwebredir.domain.co.uk.	7200	IN	A	62.193.206.144
webmail.domain.co.uk.		7200	IN	A	80.168.46.11
www.domain.co.uk.		7200	IN	A	195.8.78.1
domain.co.uk.			7200	IN	A	195.8.78.1

We will take a look at a breakdown of the zone based on the record type:

[edit] Type NS records

The 2 records of type NS on top will define what the DNS servers are for the domain. In this case, for domain.co.uk there are 2 DNS servers: ns1.amenworld.com and ns2.amenworld.com:

domain.co.uk.			7200	IN	NS	ns1.amenworld.com.
domain.co.uk.			7200	IN	NS	ns2.amenworld.com.

These records do not need to be defined by you, as the system will automatically add them to your zone.

[edit] Type A and CNAME records

As we should know by now, the A records will point to the IP address of a server, while the CNAME records will point to the host name of the server.

Each one of these types will look like this on the DNS zone:

testalias.domain.co.uk. 	7200	IN	CNAME	www.domain.co.uk.
testip.domain.co.uk.		7200	IN	A	62.193.23.36

[edit] Example #1: A vs CNAME

If I am the administrator for the domain domain.co.uk and I want www.domain.co.uk to point to a server called wpc0000.amenworld.com with IP address 62.193.0.0, I can do it in 2 ways:

  • create the WWW record for the domain as an IP Address on the Control Panel and enter the 62.193.0.0 IP address
  • create the WWW record for the domain as an Alias on the Control Panel and enter wpc0000.amenworld.com as the value

In both cases, the record will act in the same way and will take us to the same server. The main differences are that:

  • with a CNAME record, our DNS servers will need to resolve 2 names: www.domain.co.uk and then wpc0000.amenworld.com. This means that it will take a tiny bit longer, but it should not be noticeable. The risk is that now we have double the chance that the DNS server is down or misconfigured.
  • with an IP address, we will need to change the record if the IP address of the wpc0000.amenworld.com server changes.

[edit] Example #2: Web redirection vs A and CNAME

Out of the 3 types of DNS entries allowed in the Control Panel we have stated that:

  • IP Address is the same as an A record
  • Alias is the same as a CNAME record

We have not said what the equivalent of Web redirection is ... because there is no equivalent for it: it is not a DNS record type. If we look at our DNS entries definition, we created the following entries:

SUBDOMAIN TYPE VALUE
TESTALIAS Alias / CNAME www.domain.co.uk
TESTIP IP Address / A 62.193.23.36
TESTWEBREDIR Web Redirection http://www.domain.co.uk

Each one of these entries was was created in order to test the DNS records they would generate:

testalias.domain.co.uk. 	7200	IN	CNAME	www.domain.co.uk.
testip.domain.co.uk.		7200	IN	A	62.193.23.36
testwebredir.domain.co.uk.	7200 	IN 	A	62.193.206.144

So, testalias is a CNAME record and testip is an A record, no surprise there. What might come as a surprise is that testwebredir has been translated as an A record.

As we said above, the Web redirection type of entry is not a standard type of record. It is merely a piece of html code on a server that will make your browser load another website. In any case, we need to point the domain to that server, so for that we will use an A record. On the server at 62.193.206.144 there will be an html page for testwebredir.domain.co.uk (and only for that domain, as the server will support other domains too), which will take us where we want to go (in this case http://www.domain.co.uk).

Please note that even though they might look similar, the Alias and Web Redirection types of entries are not the same.
  • If you are going to use ALIAS, the server will need to be set up to support the domain. If you use ALIAS but the server does not support the domain, the server will reply to your browser with a default or an error page
  • If you cannot set up the server to support the domain, then you should use WEB REDIRECTION

[edit] Type MX records

The MX records define the mail exchange records for the domain. They specify the name of the servers that will get mail for the domain. Please note that any incorrect changes made to these entries might end up with you not being able to receive emails, so make sure you are doing the correct modifications at all times.

In the example, these are the DNS records that have been specified:

domain.co.uk.			7200	IN	MX	10 mx1.domain.co.uk.
domain.co.uk.			7200	IN	MX	20 mail.anotherdomain.co.uk.
domain.co.uk.			7200	IN	MX	30 mx30.domain.co.uk.

As mentioned in the Configuration of your DNS zone tool, the system only allows you to define 3 types of record (IP ADDRESS, ALIAS and WEB REDIRECTION), so at first look there would be no way to add MX records to your zone.

The way it works is the following:

  • There are 2 special subdomains MX1 and MX2. Each one of them is treated as a mail exchange record:
    • MX1 will have a preference value of 10
    • MX2 will have a preference value of 20
  • You can have as many MX records as you want, so if you need more than 2, you can add new ones by creating a subdomain called MX## (where ## is a number between 10 and 99 and will define the value of the preference for that mx record) and pointing it to the correct server.
The preference in the MX records will define the order in which the servers will be contacted:
  • A server trying to send an email to the domain will try the MX server with lower preference.
  • If that one does not respond, it will try the one with the next lowest preference and so on.


So, in order to end up with the DNS settings above, we did the following on the DNS zone configuration interface:

  1. MX1 was created by default and is pointing to the correct server so no changes needed there
  2. We needed a new record with a preference value of 20 to point to a server called mail.anotherdomain.co.uk, a server which will give mail service to my domain. What we did here was create MX2 as an alias (CNAME) of mail.anotherdomain.co.uk
  3. And, finally, we created MX30 (MX record with preference 30) which will point to our final back up server. This time we created it as an IP address (A) record.

This is what the mail configuration will look like both in the control panel and the DNS zone:

CONTROL PANEL ACTUAL DNS ZONE
MX1 80.168.44.11
the server that receives your emails
mx1.domain.co.uk. 7200 IN A 80.168.44.11
domain.co.uk. 7200 IN MX 10 mx1.domain.co.uk.
MX2 mail.anotherdomain.co.uk
backup server that receives your mail
mx2.domain.co.uk. 7200 IN CNAME mail.anotherdomain.co.uk.
domain.co.uk. 7200 IN MX 20 mail.anotherdomain.co.uk.
MX30 80.168.66.11
backup server that receives your mail
mx30.domain.co.uk. 7200 IN A 80.168.46.11
domain.co.uk. 7200 IN MX 30 mx30.domain.co.uk.

Note that each MX related "record" created on the Control Panel will spawn 2 records on the DNS zone:

  1. the definition of the record itself (mx1.domain.co.uk, mx2.domain.co.uk and mx3.domain.co.uk)
  2. the definition of that record as an MX record
Personal tools
Toolbox