Dark Light

Often I’m working with people who own a domain, but don’t really know what that means, or how it connects to the real world. Or at least the internet. Here’s a basic guide to how stuff plugs together. There are four roles involved:

  1. The Owner
  2. The Registrar
  3. The DNS Host
  4. The Server

The Owner

The owner is you. Hi. The person or persons unknown who put down their credit card and said “That one” and bought a domain.

The Registrar

This is who you gave your credit card details to. They put a record for that domain up in the global DNS system that says “the owner for this domain is The Owner, and the DNS Host is”. This information is public, though a lot of the time Registrars will sell you the ability to use redirecting email addresses and blanked out physical addresses.

The DNS Host

Domains are text – aquarionics.com – but traffic is routed on the internet to IP addresses – 5.9.98.12. DNS, the Domain Name System, is the method by which this translation occurs. Very simply, a request for www.aquarionics.com will make a request of your DNS host as to where that means, like a taxi driver reliant on a GPS.

For most people, your DNS host will be your registrar. They host your Name Server, and that’s something you set on the domain with your Registrar. For example, Aquarionics.com is registered with Namecheap, but my DNS is hosted by Amazon’s “Route 53” DNS service. With Namecheap, I set my name server settings to point at Amazon’s service.

Generally, as I say, this is something your registrar does for free as part of your domain hosting, it’s likely you have a “host name” admin section of your registrar.

This is one of the common points where your hosting company might ask you to change your domain settings.

Very simply, a domain record is made up of four things: a name, a type, a value and a TTL or “Time to live”:

Name Type Value TTL
www.aquarionics.com.
A
5.9.98.12
3600
dailyphoto.aquarionics.com. CNAME dc80vpukp1283.cloudfront.net 300

Name: The domain to match. By the point we’re here, the system already knows the “aquarionics.com” bit, but there will be seperate options for “www” and any other things underneath it, including nothing at all.

Type: “A” records link the name (www.aquarionics.com) to an IP address (5.9.98.12). “CNAME” records link it to an alias. So in the above, going to dailyphoto.aquarionics.com looks up that record, sees a CNAME for dc80vpukp1283.cloudfront.net, so it goes to find out what that means, which comes back as “54.230.2.28”. It’s worth noting that this isn’t a redirect for the user, it’s making the request of another DNS service. The answer is always eventually going to be an IP address where the full “Send me this website” request will be made. (Other record types include TXT for arbitrary text strings, AAAA for IPv6, and some others. They’re beyond the scope of this article)

Value: What comes back

TTL: How long to keep this information, in seconds. In the above, the record for www.aquarionics.com should be kept for an hour, but for dailyphoto you should ask again in five minutes.

The Server

The actual computer at the other end of this, numbered 5.9.98.12, which gives out the website.

Because you've made it this far, have a picture of Oolong the rabbit with a waffle on his head.
Because you’ve made it this far, have a picture of Oolong the rabbit with a waffle on his head.

How does this fit together?

If someone’s never visited your site before, like this: (I’m simplifying this quite a bit)

You type in “www.aquarionics.com”. Your computer asks the DNS system what IP address that means. The global DNS system goes “You should ask The DNS Host”, the DNS host goes “The answer is currently 5.9.98.12, but ask me again in an hour”, your browser sends a request to the server at 5.9.98.12 saying “Can I have the front page of www.aquarionics.com, please” and that’s the end of the DNS bit.

There is stuff that makes this more complicated. For example, at any point you can get more than one answer. If you ask for dailyphoto.aquarionics.com, for example, you get an answer like this:

;; QUESTION SECTION:
;dailyphoto.aquarionics.com. IN A
;; ANSWER SECTION:
dailyphoto.aquarionics.com. 300 IN CNAME dc80vpukp1283.cloudfront.net.
dc80vpukp1283.cloudfront.net. 60 IN A 54.230.0.17
dc80vpukp1283.cloudfront.net. 60 IN A 54.240.166.182
dc80vpukp1283.cloudfront.net. 60 IN A 54.230.0.63
dc80vpukp1283.cloudfront.net. 60 IN A 54.230.1.191
dc80vpukp1283.cloudfront.net. 60 IN A 54.230.3.11
dc80vpukp1283.cloudfront.net. 60 IN A 54.230.1.201
dc80vpukp1283.cloudfront.net. 60 IN A 54.230.2.28
dc80vpukp1283.cloudfront.net. 60 IN A 54.192.3.191

Which translates as:

You asked for dailyphoto.aquarionics.com. It’s aliased to dc80vpukp1283.cloudfront.net, which has these records. Multiple answers for the same question means they’re all right, and you can pick any (but usually from the top down, trying each until you get an answer)

Mail works exactly the same way, but instead of “A” records and “CNAME” records, you have “MX” or “Mail eXchange” records which dictate servers that accept mail for this domain:

aquarionics.com.        300     IN      MX      10 alt1.aspmx.l.google.com.
aquarionics.com.        300     IN      MX      10 aspmx.l.google.com.
aquarionics.com.        300     IN      MX      20 alt2.aspmx.l.google.com.
aquarionics.com.        300     IN      MX      20 aspmx2.googlemail.com.
aquarionics.com.        300     IN      MX      30 aspmx3.googlemail.com.

Unlike the records above, MX records have priorities attached, so you should only go for alt2.aspmx.l.google.com if alt1.aspmx.l.google.com isn’t responding.

Changing hosting providers

This is where this usually comes up as a thing. If you’re moving where your website is hosted, your new company will almost certainly request this DNS change.  This is where TTL comes in. A while (days) before this is coming, you should lower the TTL for the website’s records to 30 seconds or so. This will mean that when you do actually make the change, the rest of the internet will not try to keep the old answer for ages.

This doesn’t always work perfectly. Your computer keeps its own cache of DNS answers, and is almost certainly using your router as a DNS server. That in turn is making requests of your ISP’s DNS servers, which are probably asking the global systems. That’s a moderate number of systems that need to be honouring the times correctly for this to work properly, which is why the standard advice of “2 days for changes to flush though” is still so common. You’ll get 80% in the first half hour or so, but the remaining 20% might take a bit longer.

@ and *

@ is a little overloaded, and this is one of the places where it is. Some hosting providers will give you a record with the Value “@”, which stands for the unadorned domain itself, so just “http://aquarionics.com”. Notably, this isn’t allowed to be a CNAME, or alias, it needs to be an actual IP address.

* is a wildcard domain. So having a record for “*.aquarionics.com” pointing at  109.74.193.20 would mean that going to anything like that “fakedomain.aquarionics.com” up to “supercalifragilisticexpialidocious.aquarionics.com” would all resolve to 109.74.193.20

Conclusion

That’s it, I think. Slightly more tech than it should ideally be, I know, but with any luck a useful reference.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Related Posts