Common Types of DNS Records
DNS allows for a lot of different DNS record types. Each record type is used for one specific thing. An "A" record matches a domain name to an IP address. That is all an "A" record does. To do anything else with DNS you must use a different type of record.
There are actually a whole bunch of different DNS records. However, most of them are fairly obscure and rarely used. Here is a list of the most common DNS records. There are the DNS records you should know if you are a website administrator.
The A record points a domain name to an IPv4 address. For example, and A record might point example.com to 10.23.12.212.
This allows computers to find the IPv4 address of the server for a domain name. They are then able to contact the server and ask for the website content, etc.
An MX record is tells computers where to send emails for a domain name. A MX record points to A and AAAA records. It should not point to an IP address itself.
When sending an email, computers need to know the destination IP address of where the email is going. To do this, they look at the MX record for the receiving domain name. The MX record should point them to an A or AAAA record which will have an IP address for them to reach.
The AAAA record points a domain name to an IPv6 address. This is almost the same thing as an A record, but for IPv6.
This allows computers to find the IPv6 address of the server for a domain name. They are then able to contact the server and ask for the website content, etc.
A CNAME creates an alias for one domain. When a domain name has a CNAME record, all DNS queries for that domain name will instead resolve to the target of that CNAME record. The target of the record is another domain name.
For example, if you have test.example1.com CNAME test.example2.com all queries for test.example1.com will resolve as if they were directly querying test.example2.com. So a query for an IP address will for test.example1.com will return the IP address for test.example2.com instead.
Note that a CNAME always take precedence over all other DNS records. This can lead to trouble. A CNAME should not be used for a top level domain because it will take precedence over the NS record, leading DNS queries to give incorrect or mixed results.
Be careful when using a CNAME. It is usually better to use some other type of redirect, like a 301 redirect when trying to point one website to another.
An NS record points shows where the domain name's authoritative name server(s) can be found. An authoritative name server is where other name servers go to find new DNS information or check for DNS updates for a domain name.
A PTR record is like a backwards A record. It points an IP address to a domain name.
This is used for revers DNS lookups. It is also useful as a anti-spam measure. When a PTR record is setup, email servers know exactly which IP addresses are allowed to send emails from a certain domain name. This stops spammers for spoofing fake emails from an existing domain name.
The above are the main types of DNS records. Each of them performs a single function, but those functions are often crucial for the Internet to run correctly.
If you are going to be administering an email server, webserver or if you are going to act as a webmaster, you should be familiar with all of the above.