For your web browser to display a website it needs to translate the domain name into something called an IP address. This is all done by DNS (domain name system).
In my last blog post I explained how DNS and domain names work. This is the second part, taking a look at the main DNS record types and what they’re used for.
DNS record types:
For a full list check the Wikipedia DNS record type list.
Without nameserver (NS) records a website would not work.
The NS record is stored by the Top Level Domain (TLD) server.
There are over 1,000 TLD servers. There is one for .com domains, another for .gov domains, and so on.
You can update your NS record with the company you bought your domain from (also known as your domain registrar). The domain registrar will then update the TLD server.
NS records look something like this.
You normally have at least 2 NS records.
They look like a website URL, but Instead of linking to a website, they link to the domain names authoritative nameservers.
The authoritative nameservers store most of your DNS records with a few exceptions such as NS and glue records.
When you buy a domain name it normally has some default NS records managed by the domain registrar.
For example my websites registrar is hover.com. Their default NS records are:
You can use the domain registrars authoritative nameservers to add other DNS records such as a CNAME or A record.
However, as soon as you change NS records to point somewhere else any DNS records added with the domain registrar will be ignored.
Hopefully your domain registrar will say your DNS settings aren’t in use – 123-reg do.
Unfortunately some don’t which can be confusing – it confused me.
Basically the NS record is king. They have ultimate control of where a domain should go.
Glue records are only needed if you are running your own nameservers – most people don’t.
A glue record is the IP address of the authoritative nameserver. You create the glue record with your domain registrar.
A record, also known as IPv4 address record
The A record is used to point the domain name at one or multiple IP addresses.
An IP address looks something like this 22.214.171.124
The IP address is the place where your website is hosted.
If you use a managed hosting provider, such as wordpress.com, and you are using the hosting providers nameservers you won’t need to create an A record.
If or when you create an A record there are three fields to fill in:
I’ve seen the ‘name’ field called hostname, alias, prefix and DNS entry. Whatever it may be called there are three variations of what could go in the field:
- Subdomain such as www
An @ in the ‘name’ field means the A record will only affect the second level domain (SLD) – also known as the root domain.
An * (asterisk) in the name field is a wildcard, and represents any subdomain / prefix. For example, creating the record *. pbrumby.com would affect all subdomains such as:
The last option is to add the specific subdomain / prefix. For example www or preprod.www
Just like the name field I’ve seen this called ‘IP’, ‘content’ and ‘target name’. This is where you add your website server IP address.
All DNS records has a TTL (time-to-live) entry.
The TTL indicates how long until your computer, or resolver has before it should recheck with the authoritative nameserver.
For example if you set the TTL to be 5 minutes it would take 5 minutes for all the computers in the world to use your new setting.
You can check the TTL on any DNS record by using a DNS checker such as Google’s dig.
The format you get back looks something like this.
google.com. 300 IN A 126.96.36.199
The first number ‘300’ is the TTL. It is measured in seconds. So 300 seconds equals 5 minutes.
AAAA record, also known as IPv6 address record
AAAA record does the same thing as the A record but the IP address is a longer.
Internet Protocol version 4 (IPv4) defines an IP address as a 32-bit number. However, because of the growth of the internet and the depletion of available IPv4 addresses, a new version of IP (IPv6), using 128 bits for the IP address was created.
If you are already using an A or AAAA record for a subdomain you wouldn’t use a CNAME.
The Canonical Name record (CNAME) tells anyone visiting that subdomain to use the same DNS records as another domain / subdomain.
This can be convenient when running multiple services from a single IP address.
CNAME records must always point to another domain / subdomain, never directly to an IP address.
CNAME records also only work for subdomains.
For example you couldn’t use a CNAME for pbrumby.com.
But you could for a subdomain like www.pbrumby.com.
Using a CNAME record can cause a very minor delay of a few milliseconds as there is an additional request sent to the DNS servers.
Mail Exchanger (MX) records are used to create email addresses from that domain.
The MX record is used to tell the world which mail servers accept incoming mail for your domain and where emails sent to your domain should be routed to.
MX records consist of four parts:
- Priority (number)
The name, destination and TTL fields do the same thing as the A record fields. The only difference is the priority number which is used to indicate which server should be attempted to be used first. The lower the number the higher the priority.
In the example below for google.com the first number, 600, is the TTL. The second number (10, 20 or 30) is the priority. The first record (alt1.aspmx.l.google.com.) has the highest priority as it has the lowest number.
google.com. 600 IN MX 10 alt1.aspmx.l.google.com. google.com. 600 IN MX 20 alt2.aspmx.l.google.com. google.com. 600 IN MX 30 alt3.aspmx.l.google.com.
A TXT record (short for text record) is used to add arbitrary text.
It’s often used to include verification of domain ownership.
This is by no means a complete list. It does however cover the most common uses.