What is DNS?
The DNS (Domain Name System) is a decentralized system with a strict hierarchical structure for naming devices and services on the Internet and private networks. It is an essential part of how today’s global connected network, the Internet, works.
It is responsible for directing queries for a particular domain name, like goolge.com, through all the nameservers of different levels that know where the imputed domain name is located. It helps us by answering our domain name queries with the IP address of the host (IPv4 or IPv6 or both).
It also finds services, verifies them in different ways, links different domain names, points to servers, redirects, and, in general, makes our lives a lot easier when using the Internet.
All the needed instructions are saved in text documents that are called DNS records. Depending on the query, your device will ask for one or more of these DNS records. The query will travel through different recursive DNS servers and will get an answer from them or, if they don’t know the answer, from an Authoritative DNS server that has it.
Common DNS records
To understand DNS better, see these DNS records and what they do
- A record – points a domain name to IPv4 addresses.
- AAAA record – points a domain name to IPv4 addresses.
- NS record – shows the nameservers for the particular domain name.
- MX record – shows the email servers that should receive messages for the domain name.
- CNAME record – shows that one domain is just an alias for another.
- PTR record – Links IP address to a domain name.
Why does it exist?
Before the invention of the DNS, there was a single text document with all the domain names and IP addresses, which was called HOSTS.TXT. When the number of hosts started to grow, it was getting impossible to manage it manually. Paul Mockapetris was the man in charge of finding a way out of the impossible name management. He came out with the DNS in 1983, and in 3 years, the standard was adopted by the IETF. The final result was an organized namespace, which works with the UDP protocol and provides fast name resolving.
Why DNS uses UDP?
The DNS uses the user datagram protocol (UDP) because the UDP uses small-size packets, is very fast, is connection-less (no need to establish a connection to send something over UDP), and does not need the data to be consistent.
Yes, there is the negative side that it is not really secure, but there are fixes like the full security chain called DNSSEC that makes the otherwise unsafe DNS to decently protected service.
The domain name space is organized on different levels, and many DNS servers are spread around the world. On top of all stand the root, under it, different top-level domains (TLDs), secondary domains, and subdomains.
Root level – This is the beginning of the DNS. The DNS resolution starts from here and goes to one of the name servers for the domain’s TLD. Its sign is “.”, at the end of the domain name, but typical users don’t use it.
TLD level – The top-level domains are all the extensions like .com, .co.uk, info, and so on. In the TLD name servers, you will get the answer, which nameservers know the domain name you are searching for.
Second level domain. Now, this is the name of the site that you are visiting without the TLD extension. For example, Google, from the google.com.
Subdomain level – the subpart of the domain name that you can see before the domain name, and it is separated by a point (“.”). Example, the blog from blog.google.com.
Why is DNS so important?
It is so important because, without it, every operation on the Internet will take a longer time and will require us, the humans, to remember a lot of information. The DNS facilitates communication on the Internet and makes domain name queries look so simple and fast. Thanks to the system, almost any website can be reached 24/7.