Domain Name System: How does DNS work?
How does DNS work?
When the user enters the URL into their web browser, DNS connects that URL to the actual IP address of the server. This is called the DNS name resolution and involves DNS recursively querying different name servers to find out the exact IP address of the server.
DNS is primarily concerned with four components:
- domain registrar
- name servers
- DNS records
- Web-based services (such as hosting websites and email)
Let’s talk about all these four components and also how they work together.
The domain registrar is the service provider where the domain names are purchased, and domain registration is kept (e.g., GoDaddy or Namecheap).
The registrar is where the domain name servers are identified.
Most registrars include a basic DNS service with the cost of domain registration. As a result, unless you add custom name servers to the domain, the domain will use the registrar’s standard name servers. It means that in the vast majority of the cases, by the default, DNS records are managed by the registrar.
Name servers are servers much like the web servers. However, they are configured to store the DNS records instead of serving websites or web applications.
When you want to change the any DNS record, you must change those DNS records on name servers specified by the registrar or a third-party service like Cloudflare.
This step is often a bit confusing, so let’s break it down a bit by looking at a fictional example:
Your domain (example.com) is registered with GoDaddy.
You can add Cloudflare name servers to example.com within your GoDaddy account to start using Cloudflare.
I changed the DNS record for example.com in GoDaddy. Unfortunately, this change won’t do anything because the domain doesn’t use GoDaddy’s name servers.
You make the exact DNS change, for example.com, in Cloudflare. This change will also be effective because the domain uses Cloudflare name servers.
In other words, if you only use GoDaddy, you will need to update your DNS records with GoDaddy because they control your name servers. If you are using the Cloudflare, you will need to update your DNS records with Cloudflare because it contains your name servers. The same goes for those who use Kinsta DNS.
You cannot visit a website without first accessing the domain name server. In the process, you may encounter a message like “DNS server not responding,” which means that the decentralized naming systems responsible for converting hostnames to IP addresses failed to respond.
The DNS records associate a domain with a web-based service.
There are several different types of the DNS records, but in most cases, only 4 or 5 types of DNS records are used:
- Records: These are used to point a domain or subdomain to an IPv4 address. This is the rule to point a domain like example.com to the web server where example.com lives. (Note: If the web server uses an IPv6 address instead of an IPv4 address, an AAAA record is used instead of the A record.)
- CNAME records: These are used to associate a subdomain with the primary or primary domain. This rule commonly associates a www subdomain with the base domain, such as the www.example.com with example.com.
- MX records: Used to associate the domain with an email service. This is the rule used if you want to mail, for example.com, to be delivered to a specific email service like Gmail.
- TXT records: it is used to associate any arbitrary text with a field. The most common is the use of TXT records to associate SPF records with the domain to improve email deliverability and protect against the spammers misusing the domain name when sending spam.
In some cases, web service is web hosting. Therefore, an A record (or AAAA record) must be added to the domain name servers to associate that domain with the web servers hosting the website.
There are many other types of the web services associated with a domain through the DNS records: email, SFTP, hosting control panels, the webmail applications, and phpMyAdmin, to name a few.
Free DNS vs. Premium DNS
You can find both the Free DNS and Premium DNS. In addition, all Kinsta customers get access to premium DNS via Amazon Route 53. All in all, we believe a premium DNS is a necessity in today’s world.
One of the main reasons for choosing Premium DNS is speed and reliability. Looking up DNS records and routing traffic takes time, even if it’s just a fraction of a second.
The free DNS you will get from a domain name registrar is usually relatively slow, while premium DNS offers better performance.
In addition, a premium DNS can provide better security and availability, especially when you are under a DDoS attack.
For a good compromise between the free DNS provided by your domain registrar and the premium DNS, Cloudflare DNS is the free service that still offers many of the benefits of a premium DNS. Just be aware – if you are using Cloudflare DNS, you will not be able to use the premium DNS built in from Amazon Route 53.