Monday, November 17, 2008

Domain Name System Overview

Introduction
Since the Internet has become essential for software engineers, its useful to know about the Domain Name System. The article attempts to Give a brief description of DNS Talk about the naming conventions used What is A-Records and CNAME Records How to Get a List of A-Records from a DNS. Though DNS is a very vast concept, which cannot be explained in one single article, Ive tried to do my best to give you a picture.
Domain Name System: (DNS)
It is an Internet service that translates domain names into IP addresses. Because domain names are alphabetic, theyre easier to remember. The Internet however, is really based on IP addresses. Every time you use a domain name, therefore, a DNS service must translate the name into the corresponding IP address. For example, the domain name www.example.com might translate to 198.105.232.4 The DNS system is, in fact, its own network. If one DNS server doesnt know how to translate a particular domain name, it asks another one, and so on, until the correct IP address is returned.
DNS name structure:

DNS names are constructed hierarchically. The highest level of the hierarchy being the last component or label of the DNS address. Labels can be up to 63 characters long and are case insensitive. A maximum length of 255 characters is allowed. Labels must start with a letter and can only consist of letters, digits and hyphens. [Unfortunately some administrators construct names that start with digits. This is wrong and can easily cause problems with software that simply inspects the first character of a host address to determine whether a DNS name or an IP address has been quoted.]. Some of the Key points regarding the Naming are as follows.
Arpa This is a special facility used for reverse translation, i.e. going from IP address to fully qualified domain address. If everything is properly configured a suitably framed query for 1.4.220.134.in-addr.arpa will return sunc.scit.wlv.ac.uk.
3 letter codes The DNS was originally introduced in the United States of America and the final component of an address was intended to indicate the type of organization hosting the computer. Some of the three letter final labels (edu, gov, mil) are still only used by organizations based in the USA, others can be used anywhere in the world.
Two letter codes The final two letter codes indicate the country of origin and are defined in ISO 3166 with the minor exception that UK is used for the United Kingdom rather than gb although there are some .gb sites. [This apparently happened because the ISO committee was unaware that Northern Ireland was part of the United Kingdom but not part of Great Britain.]
Some sites in the United States of America use the two-letter code US. In some countries there are sub-domains indicating the type of organization such as ac.uk, co.uk, sch.uk in the United Kingdom and edu.au and com.au in Australia. Most European countries have not adopted this useful practice. A fuller discussion of the United Kingdom DNS domains is provided by the UK Network Information Center. To obtain a domain address it is necessary to identify the administrator of the required domain and then all that is basically necessary is to send the administrator the required code and the associated IP address and they will, if they accept the request, include the details in their databases. Conditions for acceptance vary widely between administrators, the administrators for the com and org being, apparently, quite happy to accept anything from anywhere.

A-Records: "A" Records are what DNS really boils down to. An A record gives you the IP address of a domain. That way, users that try to go to www.example.com will get to the right IP address.

Get a list of all your A records There are several ways you can go about this. The best way is with a Zone Transfer. This will show you every record in your DNS. However, your name servers may refuse zone transfers to any computer except the secondary name servers. In that case, you'll have to go to one of the name servers, and get the master zone file.To do a zone transfer in NSLOOKUP, first type "server nameserver.example.com", where "nameserver.example.com" is one of your name servers (try the primary name server first, if it doesn't work, try the secondary(s)). Then, type "ls -d example.com". If you have a lot of entries, you might want to save it to disk using "ls -d example.com > filename.txt", where filename.txt is the name of the file to save to (you might not be able to choose a directory, it may place it automatically in the directory you are in). This will list all records in your zone.To do a zone transfer in Sam Spade, go to the Tools menu, and choose "Zone Transfer" (if it is grayed out, go to the Edit menu, choose Options, then the Advanced table, and click 'Enable zone transfers'). Enter your domain as the domain to transfer zone information from. Enter your primary nameserver as the nameserver to use. If your primary nameserver refuses to do a zone transfer, try the secondary nameserver(s). Just pay attention to the A records for now.If you can't get a zone transfer, the next step is to get the zone file from your primary nameserver (you'll may need to look at the instructions for your DNS server software to see where the file is located). Then, use NSLOOKUP, DIG, or other software to check all the A records (using your primary name server as the name server to use) for the domain names listed in the zone file to make sure that they match. If you don't have access to your nameservers (if an ISP handles your DNS, for example), and you can't do a zone transfer or get the zone file, you should at least know the subdomains on your domain (for example, "www.example.com" and "mail.example.com"). Use NSLOOKUP, DIG, or other software to look up the A record for each of those domains (using your primary nameservers as the name server to use).

Note: If you know a subdomain exists (such as www.example.com), but there is no "A" record, that may be O.K. -- there could be a CNAME record pointing to another record that has an A record. For example, "www.example.com CNAME sparky.example.com" with a corresponding "sparky.example.com A 10.11.12.13". However, it is best to avoid using CNAMEs unless you are quite familiar with them!

Note: CNAME records are "canonical name" records. DNS allows machines to have a true (canonical name), as well as an unlimited number of aliases. The CNAME record takes care of aliases. These should only be used when absolutely necessary, unless you are very familiar with DNS, since they can cause lots of problems if not used properly. Reference Links:1. http://www.microsoft.com/technet/archive/winntas/maintain/optimize/16wntpcc.mspx?mfr=true2. http://www.microsoft.com/exchange/evaluation/overview/default.mspx