DEV Community

Abishek Haththakage
Abishek Haththakage

Posted on

DNS Basics: How Domain Name System Connects Websites

What is DNS?

DNS stands for Domain Name System. It’s like the phonebook of the internet. Instead of remembering long strings of numbers (IP addresses), DNS lets us use easy-to-remember names (like google.com) to visit websites.

Every device on the internet has an IP address, but DNS allows you to type a simple web address (domain name) and connect to the website without knowing the IP address.

DNS

How Does DNS Work?

DNS converts (or resolves) a domain name into its IP address so your computer can find and connect to it. Here’s how it works step-by-step:

  1. Your browser asks for the IP address of the website you want to visit (like google.com).
  2. The DNS Resolver (usually provided by your internet service) looks for the IP address.
  3. If it doesn’t have the IP address stored, it contacts a Root Nameserver, which tells the resolver where to find more info.
  4. The resolver then asks a TLD Server (Top-Level Domain, like .com, .org, etc.) for the right Authoritative Nameserver.
  5. The Authoritative Nameserver finally gives the correct IP address to the resolver.
  6. The browser then uses this IP address to connect you to the website.

How DNS work

Types of DNS Records

DNS uses different records to store important information about websites. Here are the most common ones:

  • A Record: It maps a domain name to an IPv4 address (like 192.168.1.1).
  • AAAA Record: Similar to A Record, but for IPv6 addresses (a newer, longer IP address format).
  • CNAME Record: Points one domain name to another (used when websites have multiple names).
  • MX Record: Directs emails to the correct mail server for a domain.
  • NS Record: Lists the nameservers that handle the DNS requests for a domain.
  • SOA Record: Contains info about the domain, like when it was last updated.
  • SRV Record: Specifies servers for specific services (like email or voice calls).
  • PTR Record: Maps an IP address back to a domain name (reverse lookup).
  • TXT Record: Can store any text, often used for security (like verifying domain ownership).

DNS Record Types

Why is DNS Important?

DNS is crucial because it makes the internet easy to use by allowing us to remember names instead of numbers. It also ensures that when you type in a web address, you are sent to the right place. Without DNS, the internet would be much harder to navigate.

DNS Challenges

Sometimes, DNS can have problems, like:

  • Outages: If DNS servers fail, websites can become unreachable.
  • Security Threats: DNS is a target for hackers who may launch attacks like DDoS or cache poisoning, which can take down large portions of the internet.
  • Misconfigurations: Small mistakes in DNS setup can lead to websites being down.

Monitoring DNS

To prevent problems, businesses often use DNS monitoring tools to keep track of DNS performance and security. These tools can:

  • Check if DNS servers are working well.
  • Spot errors or delays in resolving domains.
  • Detect security threats like attacks on DNS servers.

DNS is the backbone of the internet, allowing us to use simple domain names instead of complex IP addresses. While it’s a powerful system, it can face challenges, so it’s important to monitor and secure DNS to ensure websites and services run smoothly.

Okay, that’s it for this article.
Also, if you have any questions about this or anything else, please feel free to let me know in a comment below or on Instagram , Facebook or Twitter.

Thank you for reading this article, and see you soon in the next one! ❤️

Top comments (5)

Collapse
 
petrar2d2 profile image
PetraR2D2

Cool article, thanks!

I have an additional question, whose responsibility is to provide DNS servers? As owners of an app, we will register app's name with DNS when we deploy it I guess, but who or what "owns" DNS?

Collapse
 
abhixsh profile image
Abishek Haththakage

DNS (Domain Name System) is a global system, but no single entity "owns" DNS entirely.

  1. Top-Level Management (ICANN): The Internet Corporation for Assigned Names and Numbers (ICANN) is responsible for coordinating the global DNS and assigning domain names and IP addresses. They delegate control to regional and country-based organizations.
  2. Domain Registrars: These are companies authorized by ICANN to sell domain names (like GoDaddy, Namecheap). They manage domain registration for specific users or organizations.
  3. DNS Servers: When you register a domain, you set up DNS servers, often provided by your web hosting provider, cloud services (like AWS, Azure), or public DNS services (like Google DNS, Cloudflare).

So, as the app owner, you would register your app's domain name through a registrar, and the registrar and hosting service will handle the DNS part.

Collapse
 
kubelet profile image
Karl Kubelet

This is a great writeup, thanks for sharing! Worth mentioning that making 3 requests every time a domain needs resolution is quite slow and inefficient, which is why most resolvers will cache the results for as long as the record TTL permits. Also why you need to sometimes wait for DNS changes to propagate globally.

Thanks again and good luck!

Collapse
 
vicariousv profile image
AndrewBarrell1

Thanks, always nice to see some simple posts about core IT concepts!

Collapse
 
respect17 profile image
Kudzai Murimi

Thanks for sharing with the community, keep up the good work