Saturday, 17 November 2007

Basic - How DNS Works

In this article I will try and explain the basics of DNS, what it is, what you use it for and how important it is.

DNS is basically a set of records that allow a name you enter in a browser such as www.ippatrol.co.uk to be converted into a numeric ip address that a computer can understand and use to connect to the actual web server.

You can in many cases just use the ip address but that would be hard to remember and if it changes you will be lost so we use dns to make things easier to remember.

DNS is comprised of a number of different record types some of which I explain below.

An 'A' record is something like www, added to your domain (ippatrol.co.uk) it gives an easy to remember url www.ippatrol.co.uk. When you enter this in your browser your pc use dns to translate the 'A' record to the ip address of the web server server, requests the page and displays it.

An 'MX' record is an incoming mail server record, you normally have more than one, each has a priority. Mail will go to the lowest priority if this fails it will try the others in order. So when you send an email your isps mail server finds the mx record of the receipients mail server, gets the ip address and then connects to that server to send the email.

a 'CNAME' is a conical name and basically just points at another name (A record), it can make maintenance easier as you then may only need to change one 'A' record but I generally don't use them.

So instead of defining ftp as an 'A' record you may make ftp a cname pointing to say www so when its looked up it looks at the record for ftp, finds its a cname, looks up www and gets the ip address of the server.

A lot goes on in the background to look up a dns entry. First we have to query the root name servers (the heart of the internet), to find out which top level domain servers will help to answer your lookup.

so for instance to lookup www.ippatrol.co.uk we need to know who provides uk responses

host -t ns -d uk

;; ANSWER SECTION:
co.uk. 170706 IN NS ns6.nic.uk.
co.uk. 170706 IN NS ns7.nic.uk.
co.uk. 170706 IN NS nsa.nic.uk.
co.uk. 170706 IN NS nsb.nic.uk.
co.uk. 170706 IN NS nsc.nic.uk.
co.uk. 170706 IN NS nsd.nic.uk.
co.uk. 170706 IN NS ns1.nic.uk.
co.uk. 170706 IN NS ns2.nic.uk.
co.uk. 170706 IN NS ns3.nic.uk.
co.uk. 170706 IN NS ns4.nic.uk.
co.uk. 170706 IN NS ns5.nic.uk.

then we ask one of those servers for the domain's (ippatrol.co.uk) dns servers.

host -t ns -d ippatrol.co.uk ns6.nic.uk.

ippatrol.co.uk. 172800 IN NS ns1.dcl.co.uk.
ippatrol.co.uk. 172800 IN NS ns2.dcl.co.uk.
ippatrol.co.uk. 172800 IN NS ns3.dcl.co.uk.

In this case there are 3.

Once you have the name servers you can then lookup the record you want

host www.ippatrol.co.uk ns2.dcl.co.uk.
Using domain server:
Name: ns2.dcl.co.uk.
Address: 85.13.195.78#53
Aliases:

www.ippatrol.co.uk has address 81.201.137.96

Its actually a bit more involved than that but thats the basic idea.

You could always lookup a few domains on somewhere like dnsreport.com to see how they are set up.

You should try and ensure your dns is hosted by a reliable dns host. Unfortunately most people just rely on the free service provided by their domain registrar, spend thousands on their web site only to find the dns service is unreliable and people can't find their web site.

Be aware DNS is cached (to speed up the internet) in your browser, on your pc and on your isps's dns servers. So you may be able to access your site, but your dns servers may be down and other visitors may not be able to access it. You will only see the problem when your cache expires. So check your dns out somewhere like checkdns.net if some reports a problem.

Your dns provider should provide at least 2 dns servers (in case one fails). They should be located in different data centers so that an outage at one place does not affect your dns service.

Finally they should really be located in the country where your servers are or where your customers are, beware some dns providers who appear to be located in the UK are for instance located in North America.

A simple traceroute to their name servers should clarify the situation. The best thing to do is ask your potential dns provider all these questions.

Before registering a domain check out their dns service and also check how much it costs to transfer away from the registrar if you need to. It should be possible to do everything yourself from a control panel without their intervention. If they don't allow this or charge you for releasing your domain then avoid them like the plague.

Finally once you have configured your dns check its correct using a free service like dnsreport.com and do this every time you update it. To do a one off test of your dns, web site and mx records try checkdns.net.

Once everything is working signup with ipPatrol (www.ippatrol.co.uk) and get your web site monitored 24x7 with instant alerts via email and sms so you know when it stops working and can get it fixed before your customers notice or you start losing business. Don't rely on your isp to do this, most don't do effective monitoring (they just ping the server) and even less will tell if a problem has occurred.

No comments: