Network Administration: CNAME, PTR and MX Records
Each DNS database zone file consists of one or more resource records, including the Canonical Name (CNAME), Pointer (PTR) and Mail Exchange (MX) records. Creating and updating the resource records that comprise the DNS zone files is one of the primary tasks of a DNS administrator.
A Canonical Name (CNAME) record creates an alias for a fully qualified domain name. When a user attempts to access a domain name that is actually an alias, the DNS system substitutes the real domain name — known as the Canonical Name — for the alias. The owner field in the CNAME record provides the name of the alias that you want to create. Then, the RDATA field provides the Canonical Name — that is, the real name of the host.
For example, consider these resource records:
ftp.lowewriter.com. IN A 22.214.171.124 files.lowewriter.com. IN CNAME www1.lowewriter.com.
Here, the host name of an FTP server at 126.96.36.199 is ftp.lowewriter.com. The CNAME record allows users to access this host as files.lowewriter.com if they prefer.
A Pointer (PTR) record is the opposite of an address record: It provides the fully qualified domain name for a given address. The owner field should specify the reverse lookup domain name, and the RDATA field specifies the fully qualified domain name. For example, the following record maps the address 188.8.131.52 to www.lowewriter.com:
184.108.40.206.in-addr.arpa. IN PTR www.lowewriter.com.
PTR records don’t usually appear in normal domain zones. Instead, they appear in special reverse lookup zones.
Mail Exchange (MX) records identify the mail server for a domain. The owner field provides the domain name that users address mail to. The RDATA section of the record has two fields. The first is a priority number used to determine which mail servers to use when several are available. The second is the fully qualified domain name of the mail server itself.
For example, consider the following MX records:
lowewriter.com. IN MX 0 mail1.lowewriter.com. lowewriter.com. IN MX 10 mail2.lowewriter.com.
In this example, the lowewriter.com domain has two mail servers, named mail1.lowewriter.com and mail2.lowewriter.com. The priority numbers for these servers are 0 and 10. Because it has a lower priority number, mail will be delivered to mail1.lowewriter.com first. The mail2.lowewriter.com server will be used only if mail1.lowewriter.com isn’t available.
The server name specified in the RDATA section should be an actual host name, not an alias created by a CNAME record. Although some mail servers can handle MX records that point to CNAMEs, not all can. As a result, you shouldn’t specify an alias in an MX record.
Be sure to create a reverse lookup record (PTR, described in the next section) for your mail servers. Some mail servers won’t accept mail from a server that doesn’t have valid reverse lookup entries.