Sometimes I help people out with web servers, email servers and other internet-related stuff. I often have to explain how we control what happens when you type in www.example.com or email@example.com.
Here’s my simple guide to how internet domains work.
When you type www.example.com into a web browser, how does it know where to go to get the web page? As many people know, the answer is the DNS system. This translates www.example.com into the address of a web server. More mysterious stuff happens to connect your browser to that address, but we don’t need to know about that today.
Your domain has a set of DNS records that say where on the internet your domain’s resources (email servers, web servers etc.) actually live. You can change these records yourself, it’s quite easy.
Here are the DNS resource records you might need to change:
Address records (A): If your web server is at the internet address 18.104.22.168, for example, then you need to create an A record for www.example.com that points to that address.
Synonyms (CNAME): If there’s a resource on a server that already has a name then you can simply tell the DNS that your resource is on the same server. This is how Google Apps creates a webmail site at mail.example.com; you simply create a CNAME record that points mail.example.com at ghs.google.com.. That’s all you have to know.
Mail servers (MX): Your email is transferred by mail servers. These are the servers that actually move mail around (not to be confused with your webmail site). For Google Apps mail, the settings for the MX records are specified in Google Apps help pages.
Domain registration & name servers
Where are your DNS records kept? This is determined by the domain’s registration setup.
When you first registered the domain you will have used a registrar like GoDaddy or Network Solutions (or Gandi, the registrar I recommend). For an annual fee this company will maintain your domain’s existence on the internet and one other thing: determine where the domain’s name servers are (the name servers hold the DNS records).
When you first registered the domain, the registrar will have used their own name servers for your domain. This is to make it easy for you, but also because they are control freaks.
This is important. Many registrars try to hide the fact that you don’t have to use their name servers. In fact there are advantages in using a separate DNS provider from your registrar:
- The domain registration should be managed by your organisation's legal or administrative department. This is the master key: in the event of a problem then the name servers can simply be changed to regain control of the domain.
- Management of the DNS records can be delegated to a technical person, but it's really not difficult to do this yourself.
- Specialist DNS service providers often add extra value: for instance Cloudflare will cache your web content and speed up web access for all your users.
So in a nutshell:
- Your domain is registered with a registrar. Your account at the registrar controls where the domain's name servers are.
- The name servers manage the DNS records for the domain. You should have a separate account with a DNS service provider to manage them.
- Your web server will be controlled by an A record in the DNS setup.
- Your webmail server will be controlled by a CNAME record in the DNS setup.
- Your mail servers will be specified by MX records in the DNS setup.
If this isn’t clear please leave a comment.