on a machine that is running multiple services, such as ftp.example.com,
[http://www.example.com, and mail.example.com, and have every one of](http://www.example.com, and mail.example.com, and have every one of)
them point to the same A or AAAA record for the server with the name
example.com. That A or AAAA record points to the IP address, so if you
ever need to change the IP address, such as when you move your server or
establish a new server, you only have to change the IP record in one place.
MX
An MX record maps a domain name to a list of mail servers for that domain.
(MX comes from “mail exchange.”) If you do not use a domain for email, this
record is not needed. Here is an example of an MX record:
Click here to view code image
example.com. 14400 IN MX 0 mail.example.com.
First, notice the dot after each of the two domain names. These are vital, and
omitting them causes email to be misrouted.
The example says that any email coming in to an address @example.com
(leftmost field) should be routed to the server at example.com (rightmost
field). The DNS A or AAAA record for mail.example.com or a CNAME
record sets the IP address of that mail server. 14400 defines how often, in
seconds, to update the DNS entry in any other server that has cached this
record; 14400 is 4 hours and is standard. MX defines this as a mail exchange
record.
The 0 indicates preference because you can list more than one MX server.
Smaller numbers are preferred over larger numbers. Setting multiple servers
to the same value means that a random server with that value is to be used. If
there is only one, use 0 . A multiple-server MX record looks like this:
Click here to view code image
example.com. 14400 IN MX 10 mail.example.com.
example.com. 14400 IN MX 20 mail2.example.com.
NS
An NS records maps a domain name to a list of DNS servers that are
authoritative for that domain. It is most used at domain name registrars and
tells any query that comes in to the domain name registrar where to look for
the complete DNS record. For example, a request from an ICANN server
would look first at the domain name registrar, which would then look
wherever it says in the NS record, if the complete DNS is not hosted here.