Why Your Website Is Lost Without The DNS
Having a website in this day and age is fundamental for any brand. The presence on the web is crucial for getting new clients and having them spend time with you even from the comfort of their homes. And although in the real world you can give an address to your store by naming the street and its number, in the digital world, it is far more, well, digital. All addresses are sequences of numbers, and not knowing how to give the correct address to your client is the first step towards your fast and inevitable crash.
You might think that giving the correct domain name is enough, but web browsers don't communicate with letters but numbers. Without the means to translate these letters in a proper sequence of numbers, your website will be as visited as an old, abandoned haunted house in the middle of a cemetery during a foggy night. Thankfully, DNS won't let that happen.
What Is DNS
The Domain Name System (not "Server," as many mistakenly name it) is quite literally the internet's phonebook. For the Z Generation audience, a phonebook is literally a book containing every single phone number in a specific area. DNS is practically the same, but instead of being a book, they are digitized, and instead of looking for people's names, they look for domain names.
If you are a normal human being and not a deadly machine sent from the year 3000 to find Sarah Conor, you most probably look for a specific website with its domain name like locusdigital.com, for example. The browsers, though, don't interact with each other with letters but rather with numbers. That's why every device that is connected to the web has a unique IP address. Thus the web browser needs to find the specific machine that stores the Locus Digital data. Here is where the DNS comes into play. The Domain Name System translates the domain names into IP addresses so the browsers can find the proper data storage machine and show the user the exact page they were looking for.
Can you imagine the world without DNS servers? We would have to remember hundreds if not thousands of IP addresses, which would be a blast for all you math enthusiasts and cyborgs out there, but a fresh hell for the rest of the 99.9% of internet users.
How Does It Work
It would be so much easier to just say it's magic, but unfortunately, it isn't. As we mentioned before, the whole process runs around converting the domain name into a machine-friendly IP address. To put it simply, the DNS makes the connection between the web browser on the user's computer and the server, where the website's data is stored by finding and delivering the specific IP address that corresponds with the searched domain name.
To understand how the process works in-depth, one must first understand the different types of DNS servers.
What Are The DNS Types?
There are four types of DNS servers, each one with different tasks to show the correct website. The Recursive nameserver is the first place the browser checks whenever a user makes a query. However, the Recursor does not have any records, so it only points the query sender in the right direction. It's much like these all-so-hated voice phone operators, who urge you to press 1 if you want to talk to engineering, or press 2 if you're going to talk to customer support, and so on. Basically, it's the same idea.
Then there are the Root Nameservers, which is the first in line that actually does something about transforming the domain name into an IP address. The Root Nameserver is the one who points the recursive nameserver to a specific location, like a receptionist at a big company. It will hear your query, it will understand your need, and it will tell you the wing and the floor where you must go to resolve your search.
Next in line is the TLD nameserver or Top Level Domain server. It corresponds with the last portion of the domain name - namely the .com, eu, org, edu, gov parts. There are stores of information about each separate TLD, so the TLD nameserver will show your browser the correct folder (to put it figuratively) where the IP address is. It can be compared with an information board on a specific floor, where you can find exactly the person who knows the answer to your question.
Finally, there is the Authoritative nameserver, where the translation is finished. This is the last stop where the query will be resolved if there is a record of such a site and the user hasn't messed up the name or the TLD. So, for example, if you want to get to the Locus Digital website, but instead of .com, you place locusdigital.eu, there is no such website in this TLD. Thus, your search will fail since the Authoritative nameserver has no records of such a website.
To understand the process better, let's go through the steps of opening your website together.
The 8 Steps Of Opening Our Website.
The first step is writing the domain name into the search bar of your browser. Next, your query will be transmitted via the web to the DNS recursive server, which is your local DNS server.
In the second step, the recursive nameserver will check if it has cached this information previously, and if it had, it would give it back to the user immediately. However, if it doesn't have any cache of this website, it will send a request to the Root Server.
During the third step, the Root Server will check which Top Level Domain has the correct IP address and send the information back to the Recursive server. Each TLD like .com, .eu, .edu, and so on have their individual TLD server.
The fourth step is once again performed by the recursive nameserver, who sends a request to the TLD server.
During the fifth step, the TLD server checks its logs and sends back the location of the specific authoritative nameserver where the IP address is stored.
In the sixth step, the Recursive finally reaches the authoritative nameserver and asks for the A records of the website.
The penultimate step is when the authoritative server finds the needed records and provides them to the recursive nameserver. The local DNS server will take a copy and save it as cache if anyone else asks for the same domain. If anyone does, the Recursive DNS server won't go through steps 2 to 7 but go directly to step 8, where the DNS resolver will send the web browser the IP address of the requested domain name, and the browser will make an HTTP request to it. The server on the IP address will return the data of the webpage, which will be loaded on the browser. The browser will save the IP address of this particular domain name in its cache and won't bother the DNS servers the next time you want to visit the same website.
At first glance, this process looks a bit chaotic, and if it were done by humans, it would be filled with crying people, flying papers everywhere, and a lot of desperation. Thankfully machines are much more organized, and the whole process is a simple matter of binary resolution of three different types of queries.
Types Of DNS Queries
The queries are divided based on their specific tasks. The Recursive query, as one might guess, is the DNS client's request to the DNS recursive server for a record. Those types of queries are usually done by the browser or the Recursive server towards an authoritative server. The server will do one of two things - it will give the record if it's stored in its cache or deliver an error if there are no records.
The Iterative query allows the DNS server to respond with a guiding response instead of a concrete answer. These types of queries are usually done by the Recursive server towards the Root and TLD servers. The Root or the TLD server will either directly give the IP address or point to the next server in the chain to resolve the query.
Finally, there are the non-recursive queries. In this type, the DNS client asks for a record that it has access to. This could be because it's the authoritative nameserver or because it has the information cached. Either way, the server will satisfy the query.
As it becomes evident, having your website cached is incredibly important. But let's see how important it actually is.
Why Do You Need Server Cache?
Going through all this mumbo-jumbo above, about everything that happens after you type a website name in the browser search bar, surely it comes to mind that it takes some time to get done. If these queries happened in a government agency, they would take 6 to 8 weeks each. However, thankfully, thanks to the internet, the speeds are much higher. Every step takes just a few dozens of milliseconds. However, if it goes through the whole chain, these milliseconds pile up, and the user experience drops.
Caching is the only way to avoid most of the steps in loading a website. Caching may increase your website's TTL (Time to live), increasing the user experience since apparently, people now can't wait for two seconds.
Every server in the chain has a cache, and if it has the needed information, the sequence ends there. However, there are two other types of DNS cache on your computer, which help you reach the website even faster.
Browser caching, unsurprisingly, is done locally on the user's computer. Today's web browsers are set to collect cache by default, and if you are not paranoid and you haven't turned off any kind of data storing by your browser, you most probably have it. Thanks to the browser cache, when you type a domain name in the search bar for a second time, the browser doesn't need to request the DNS servers. Instead, it checks its own DNS records and finds the correct IP address. So naturally, this increases the load speed of the webpage immensely.
The Operating System DNS caching. This is the last attempt of the system to resolve your query locally. This type of cache is stored in your operating system. If the system doesn't have the needed records, it sends the request outside the local network into the Internet Service Provider, where the DNS Recursive resolver resides. Depending on the types of documents the OS DNS cache stores, it may skip all or some steps when loading a webpage.
What Types Of DNS Records Are There
As it's not so hard to guess, the DNS records provide the information about the domain that is needed for it to appear on your screen. So for a website to work, it must have a specific set of these records.
The A record or the address record is probably the most important. This is where the information about the IP address resides. For example, for a website to appear, when you enter the domain name in the search bar, the DNS will provide this A record, and it will inform the browser of the server's IP address where the website data resides. This A record may be stored as cache on your browser, OS, or in any of the DNS server types up the chain. If the server exists, the A record is in the authoritative nameserver for sure.
The CNAME or Canonical Name Record is used for redirection. It doesn't provide an additional IP address, but instead, it transfers to a similar or different domain name. However, if the domain name that is redirected to has no other records. Otherwise, the resolution of the query will lead to an error. As an example, if you have several sub-domain like mail.something.com and blog.something.com and you want them to point to your primary domain, instead of creating new A records for them, you can create a CNAME record. This way, if you need to change your IP address, you only have to change the A record, and all the subdomains will follow.
MX Record or the Mail Exchanger record tells the server which mail is responsible for receiving messages for the domain. The MX record is hierarchical, and you can make more than one, but you need to prioritize which is primary and secondary. The secondary will receive letters only if the primary doesn't respond.
TXT Records are primarily used for verification purposes but also to relay information about the domain to other servers. There are several types of TXT records like DKIM, SPF, DMARC, which help you ensure your email's security.
NS Records show which is the domain's authoritative server. Basically, this means that it shows which server contains the information about your website. When a DNS doesn't have the A records, it sends the NS records that redirect the query to the next level of servers up the chain.
There are many other DNS records, but those are the most important ones you need to know. Learning about all record types will help you swiftly resolve all problems that occur due to DNS problems. While having troubles with your DNS is not very common if you don't intentionally tamper with it, some issues may occur from time to time.
Most Common DNS Issues
The most common problem when it comes to DNS is the incorrect configuration of its records. The values you put in the record fields must be exact, or you risk baking your website. For example, if you mess up the A record, the DNS will send the wrong IP address to your browser, and ultimately it won't reach your website. Or, if you mess up the MX record, you will fail to deliver and receive emails.
Another common DNS problem is with the high TTL values. If your Time To Life value is high on your records, people trying to connect to your website will experience higher wait time, which, as we know, is punishable by death in today's society (at least social and brand death, not literal). Of course, you can always lower your TTL values, but then the query load on your website will skyrocket, and this may cause some downtime. However, if your server is powerful enough, you can go for it.
DDOS Attacks are by far the most frustrating of all since they are done not by your own mistake but by a malicious act of a third party. This is done by sending swarms of bots into your website until the server can take no more and crash.
High DNS Latency leads to high loading time, which, as we expressed several times by now, is a general no-no if you want to be relevant today. High DNS Latency may occur due to the DNS name server being geographically far away from most users. The solution is both simple and complex. On the one hand, you can transfer your server closer to the bulk of your audience. On the other, if they are from all around the world, it would be best to use a CDN.
The best way to learn about DNS is from articles like this one and not by frantically searching for answers once your website goes down. DNS is truly the system that helps your website be seen. In a sense, your website would genuinely be invisible if there wasn't DNS.
The system itself is like an information desk that navigates your browser till it reaches the correct address of the server, containing your website's data.
Knowing all the steps the browser takes to open your website may help you better your website speed. Knowledge of the DNS records, on the other hand, will help you determine problems with your web portal and resolve them promptly.
However, if any problem with your DNS occurs, you better be sure how to fix it. Otherwise, you will most definitely mess things up even more. Working with the DNS and configuring the protocols is definitely not a light task.
If you are unsure what you are doing, why not hire professionals like us to handle it for you. This way, you will achieve the desired result and be absolutely calm that nothing will go wrong.
Learn more about our offer. Click here!