DNS - The Language of the Internet
One thing I often find people new to the hosting side of web development get caught on is how Domain Name System (DNS) works, and the difference between updating a Name Server (NS) record for a domain and an individual IP address within a host file. While this may seem confusing, a little understanding of the technologies and protocols involved can help demystify an otherwise complex subject.
In a nutshell, DNS is what allows you to type www.google.com.au into a browser and it returns google’s home page. When you submit a request, the browser sends that request to your local DNS server (generally managed by your ISP) and this server recursively queries other DNS servers to find the record you requested. The IP address is then used to resolve to the correct server, the one that contains www.google.com.au.
Essentially, DNS is a hierarchical naming system for networks, like a phone book. It stores and shares records about the location of websites, and converts domain names from human readable words (www.google.com.au) into the format which computers need to communicate, IP addresses (184.108.40.206).
Domains - more than just a name
Domain names are managed by registrars or companies reselling on behalf of a registrar. Once a domain is registered, a domain is recorded in one of the various Internet organisations authoritative databases, depending on the domain extension. For example the records for .au domains are managed by AUDA. This prevents domain name double ups, and ensures that for every domain name there can only be one true record.
When domain names are looked up by DNS it is done in the reverse order we write them. Continuing with the example of www.google.com.au, the first record search is in the “.au” pool of records. From within that pool it narrows the search to the “.com.au” records, and finally it searches for “google.com.au”. This process is called a recursuve lookup, and occurs at the Top Level Domain (TLD) Name Server. The TLD server will then return which Authoritative Name Server (NS) holds the records for the domain name. This is indicated by records displayed similar to the following:
Its all about authority
An NS record attached to a domain name points to an authoritative name server, a server which contains a host file. A host file contains a list of all the various records attached to a domain name, including the domain name itself, any subdomains, mail records and IP addresses; all the information required to make a website function and become accessible via the Internet.
If you think of DNS as the phone book records for many domains, then a zone file can be thought of as the phone book records for one specific domain. It is important to note that the users don’t technically edit the zone file, they usually update records via a web based control panel such as DNS settings within Parallels Plesk Panel.
Why does it matter?
As I mentioned before, those new to the hosting side of the web can sometimes get confused or overwhelmed by how DNS works. And at some point it’s very likely that you’ll need to update details like A records, CNAME records, MX records and NS records, and an update to any one of them has profound consequences, so getting it right matters.
If you want to change the authoritative name servers, to point it to a new host file, then you are making a NS record change. This must be done at the registrar. If you want to change the IP address that a website resolves to, then you need to update the zone file. These changes need to occur at your domain’s authoritative name server, and normally through an easy-to-use control panel.
Knowing how DNS works, and the various technical names and processes involved not only provides a good overview of how the Internet works, but can also save you time and confusion when making changes to records for a website. Thankfully, we have easy-to-use web control panels which take away much of the confusion and complexity to configure DNS servers. Many systems also automatically add the required settings for you, meaning you don't need to touch a thing. If you're ever in doubt or confused, you can always contact your hosting provider who should be able to assist you to edit or update records.