Fundamentals 13 min read

What Is DNS? A Beginner’s Guide to the Domain Name System

This article explains the fundamentals of the Domain Name System (DNS), covering how domain names map to IP addresses, the hierarchical structure of DNS zones, the roles of root, top‑level, and authoritative servers, query processes, record types, and practical command‑line tools like dig and ipconfig.

Programmer DD
Programmer DD
Programmer DD
What Is DNS? A Beginner’s Guide to the Domain Name System

While lying in bed, the author helped his girlfriend fix a Wi‑Fi DNS error by editing the DNS server address and running ipconfig /flushdns, then explained what DNS actually is.

Basic Concept

Just as a phone call requires a phone number, computers need an IP address (e.g., 12.11.12.11) to communicate over TCP/IP. Humans use domain names because IP addresses are hard to remember.

A domain name is a human‑readable label that the DNS (Domain Name System) translates into an IP address. The DNS is a hierarchical naming system that organizes names into domains and subdomains.

Domain Structure

Domain names follow a tree‑like hierarchy. For example, the full name of Baidu’s site is www.baidu.com.root, usually written as www.baidu.com.. The rightmost dot represents the root domain, which is invisible to users. The hierarchy includes top‑level domains (TLDs), second‑level domains, and further subdomains.

Domain categories include:

Country code TLDs (ccTLDs) : e.g., .cn for China, .us for the United States.

Generic TLDs (gTLDs) : e.g., .com, .net, .org, .edu, .gov, .int.

Infrastructure domain : the arpa domain used for reverse lookups.

DNS Servers

DNS uses a distributed set of servers organized into zones. Each zone is managed by an authoritative name server. The three main server types are:

Root name servers – know the addresses of all TLD servers.

Top‑level domain (TLD) servers – manage second‑level domains within their TLD.

Authoritative name servers – store the actual mappings for a zone.

How DNS Queries Work

When a browser needs to resolve a domain, it checks its own cache, then the OS cache, then the HOST file, and finally the local DNS resolver. If the resolver lacks the answer, it queries the root server, which points to the appropriate TLD server, which in turn points to the authoritative server that returns the IP address.

There are two query methods:

Iterative Query

The resolver receives referrals from each server (root → TLD → authoritative) and follows them until it obtains the answer.

Recursive Query

The resolver acts on behalf of the client, contacting other servers until it can return the final result.

Manual DNS Queries

On Linux, the dig command queries DNS records. Its output includes version info, status, the question section, the answer section, and statistics. The most common query is for an A record, which returns an IPv4 address.

Typical DNS record types:

A : IPv4 address record.

AAAA : IPv6 address record.

CNAME : Alias to another domain name.

MX : Mail exchange server.

NS : Name server for a zone.

SOA : Start of Authority, mandatory in zone files.

TXT : Arbitrary text, often used for SPF.

Remember that DNS caching improves performance, so after changing DNS settings you should flush the cache with ipconfig /flushdns (Windows) or dig +trace (Linux) to see the updates immediately.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

NetworkingDNSipfundamentalsDomain Name Systemdig
Programmer DD
Written by

Programmer DD

A tinkering programmer and author of "Spring Cloud Microservices in Action"

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.