DNS: A Guide for Beginners
Why DNS Exists
Suppose I were to take your phone and delete all the contacts info from it. First of all, you’d be pissed off, but what comes after will essentially give you a big headache. Because now, all you have is a list of phone numbers and no way of knowing, which number belongs to whom. You might remember some important numbers like your parents’ but other than those handful phone numbers; you’re in for a long night of “who’s this?”
To solve this problem, you had the contacts app which stored a name associated with a particular phone number. And if I were to oversimplify DNS grossly, the above example would be perfect. Domain Name System – otherwise known as DNS, is like your contacts app, but instead of associating people’s names with phone numbers, it associates a website’s IP address with its domain name, making yours and everyone else’s life a lot simpler.
What Will Happen in its Absence
But, just like you’ll eventually restore all your contacts and will probably forget this ever happened, most of us don’t remember what happened on October 21st, 2016. That was a very dull day, as sites like Netflix and Spotify amongst others were down for many users in the US and Europe. The massive outage of key sites was a result of a massive cyber-attack on Dyne – a company that provides domain name services that are pretty crucial to how we use the internet.
Every time we type in a web address (say www.youtube.com), the domain name system translates that into the IP address of the server you’re trying to access. Without it, instead of having to remember a simple string like youtube.com, you’ll have to remember something like https://22.214.171.124/. It doesn’t precisely scream memorable, does it?
Now imagine having to remember long strings of numbers like this for every website you want to visit. So, if someone were to take down the entire DNS, they’d render the whole internet unusable for most people.
How it Works
Now that we know the importance of DNS let’s look at how it works. You see, even though most of us can access our favorite websites by punching in addresses like facebook.com, your browser needs to know the IP address of the site you’re trying to access. So, to do this, it sends a request to the DNS, and that matches a site URL to an IP address.
The DNS request first goes to a Recursive Name Server, which is generally operated by your internet service provider. Though, you can also use public servers like Google Public DNS or Quad9. The Recursive Name Server might have the IP address of the site you want to access already stored, but if it doesn’t, then it will go to any one of the thirteen root servers which manage requests for the top-level domains like .com, .org or .net.
Your request is then sent to the concerned top-level domain server (for example .com) which will then contact Authoritative Name Servers that contain an authoritative list of IP addresses and their respective URLs. This list is updated whenever someone registers a new domain. Once the IP address is retrieved, it is sent back to the Recursive Name Server, and then to your computer.
To increase efficiency and save time in the future, both the Recursive Name Server and your computer will cache DNS entries. So the next time you want to visit any website, you won’t have to go through this entire process again. Instead, your computer will either know that particular IP address already, or it will be able to get it directly from the Recursive Server.
DNS cache can help you to save a lot of time, but sometimes it can lead to some unforeseen troubles as well. You can run into some serious trouble if malware has infected your local DNS cache. It will make false DNS entries that point to malicious websites.
For example, whenever you try to open irs.gov., an attacker can instruct your PC to redirect you to the IP address of a website running a tax scam that tries to convince you to give up your personal information. But, these vulnerabilities can be avoided with the help of an anti-malware.
DNS has made the internet incredibly easy to use and thanks to it, just like we don’t have to put in the exact phone number when we want to call someone, we don’t have to put in the exact numerical IP addresses whenever we want to surf the web.
So, now you know about the rigamarole that happens in the background when you innocently type in a URL like amazon.com and actually end up at amazon.com. All thanks to the DNS.