Fundamentals 15 min read

Master DNS: From Basics to Advanced Queries with dig

This article explains DNS fundamentals, detailing how domain names are resolved to IP addresses, the multi‑step query process shown with the dig tool, the hierarchical server architecture, record types, and additional utilities, enabling readers to fully understand and troubleshoot DNS operations.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations
Master DNS: From Basics to Advanced Queries with dig

What is DNS?

DNS (Domain Name System) translates domain names to IP addresses, acting like a massive phone book.

Example: math.stackexchange.com resolves to 151.101.129.69.

Query Process

Although only an IP address is needed, DNS lookup involves multiple steps. The dig tool can display the full process. dig math.stackexchange.com The output consists of six sections: query parameters, query content, server answer, NS records, server IPs, and transmission info. Using +short shows only the A records.

dig +short math.stackexchange.com

DNS Servers

Your machine must know a DNS server's IP (often provided via DHCP or configured in /etc/resolv.conf). Public servers include 8.8.8.8 (Google) and 4.2.2.2 (Level 3). You can query a specific server with dig @4.2.2.2 math.stackexchange.com.

Domain Hierarchy

Domain names are hierarchical: host.sld.tld.root . The root zone is implicit, so it is usually omitted.

host.sld.tld.root

Root Name Servers

Root servers hold the NS records for the root zone. There are 13 root server groups (A‑M) with fixed IPs such as 198.41.0.4.

Hierarchical Query Example

Using dig +trace shows the step‑by‑step resolution from root servers to the final A records.

dig +trace math.stackexchange.com

DNS Record Types

A : address record, returns an IP address.

NS : name‑server record, points to the server responsible for the next zone.

MX : mail exchange record.

CNAME : canonical name, an alias to another domain.

PTR : pointer record for reverse lookups.

Redundancy is achieved by having multiple NS, A, or MX records.

Other DNS Tools

Besides dig, you can use host, nslookup, and whois for simplified queries, interactive lookups, and registration information.

References

DNS: The Good Parts, Pete Keen

DNS 101, Mark McDonnell

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.

DNSDomain Name Systemnetwork fundamentalsdigrecord types
MaGe Linux Operations
Written by

MaGe Linux Operations

Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.

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.