DNS Record Types
Most of the time, when someone talks about a DNS record, they are referring to the simple "directory enquiries" way of mapping a computer's name to its IP address, but this isn't always the case. The DNS can be used to find out other information as well by using different DNS record types.
Common DNS Record Types
- An A record translates a computer's name to its IP address.
Sometimes it may translate to multiple IP addresses when there
are many computers perfoming the same role.
gondolin.org.uk A 184.108.40.206
- An AAAA is the IPv6 version of a A record. This is the future.
For now, almost everyone still uses IPv4, so you won't see this much.
Techy note [+]IPv6 addresses are very different from those used by IPv4. They are made up of eight groups of 16-bit hexidecimal numbers separated by colons. For convenience you can abbreviate this slightly by replacing one (and only one) chain of consecutive groups of zeros with a double colon, as well as removing leading zeros from each group.archive.ubuntu.com AAAA 2001:67c:1360:8c01::1a
- A PTR record translates a computer's IP address to its name.
In many cases the A record and PTR record for any machine
on the Internet will match (just lookup one to find the other).
In practice, the PTR record is often forgotten (which can cause
occasional problems) or gives the name of the host computer (in
cases where multiple services live on the same computer, as in
the example below).
Techy note [+]When performing a reverse name lookup (that's what this IP address to host name lookup is called) you are really looking up names in a fake domain called in-addr.arpa. Names in this domain are formed by reversing the IP address, so the example below should really be 220.127.116.11.in-addr.arpa. The host name will also always end with a dot.18.104.22.168 PTR just64.justhost.com.
- An MX record returns the name of the mail server (or servers - there
can be more than one) for a domain. This is mainly used by
other mail servers so that they know which machine they
should deliver outgoing messages to.
Techy note [+]Along with the name of the mail server there is also a number. If there is more than one server listed, this number indicates an order of preference. The sending server should try contacting the lowest numbered one first. If it gets no answer, it should try the next lowest, and so on. It's the electronic equivalent of leaving your parcel with your neighbours if you're out.ubuntu.com MX 10 mx.canonical.com
- This returns the names of the name servers for a domain. Most of
the time there should be more than one of these. It is this
that allows one name server to refer you to another when needed
(e.g. looking up details in a subdomain)
ubuntu.com NS ns1.canonical.com
ubuntu.com NS ns2.canonical.com
- The TXT record stores general-purpose text. Originally this was
used for descriptions and other helpful information, but nowadays
it is also used to store information for specific services (e.g.
the SPF email anti-fraud system)
slashdot.com TXT "SourceForge, Inc."
- A CNAME record provides a way to give an alias to a host name,
typically used to give friendly names for computers with
hard-to-remember ones or to provide service names (like "mail"
www.gondolin.org.uk CNAME gondolin.org.uk
- This one is a bit special and not something many people really need
to worry about. SOA stands for "start of authority"
and it exists in every single Internet domain, providing information
used by other name servers to ensure they carry up to date
information about the zones they manage.
Techy note [+]The fields (in order) are:
gondolin.org.uk SOA ns1.pipedns.com. root.cl18.justhost.com. 2013021101 86400 7200 3600000 300
- Primary nameserver
- This is the host name of the computer responsible for the domain. It must be an A record.
- Contact address
- The email address of the domain's administrator (with a "." replacing the usual "@")
- Serial number
- Every time a change is made to the DNS records for the domain this must be incremented (otherwise nobody will notice the change). This is often written in a date format, as in the example.
- Refresh time
- This tells other nameservers how long they should wait (in seconds) before asking the primary nameserver whether there have been any changes.
- Retry time
- If, for some reason, a server cannot contact the primary nameserver, this says how long it should wait before trying again.
- Expire time
- This dictates the maximum amount of time a server should cache any information for the domain.
- Minimum TTL
- This dictates the minimum amount of time a server should cache any information for the domain. This field should be set carefully. If it is set too low, the primary nameserver will be very busy. If it is set too high, you will have to wait longer before any changes to the domain are noticed.
Just to add an extra level of complexity, most of the above types can have more than one value. For example, an MX record can list multiple mail servers along with a preference value to indicate in which order they should be contacted (try one and if it doesn't answer try the next on the list).