DNS Query Guide

2026-04-25·6 min read·Inquiry

DNS Basic Principles

DNS (Domain Name System) is the "phone book" of the internet, converting human-readable domain names (such as example.com) into computer-recognizable IP addresses. DNS lookup is a distributed database query process involving recursive resolvers, root domain servers, top-level domain servers, authoritative domain servers, and other hierarchical levels. Understanding how DNS works is crucial for network debugging and performance optimization.

DNS lookups are divided into recursive queries and iterative queries. In recursive queries, the client fully delegates the query to the DNS server, which is responsible for returning the final result. In iterative queries, the DNS server returns the address of the next server to query, and the client continues the query. Most home users use recursive queries, while DNS servers typically use iterative queries between themselves.

DNS Record Types Explained

# Common DNS record types

# A record - points domain to IPv4 address
example.com.    IN    A    93.184.216.34

# AAAA record - points domain to IPv6 address
example.com.    IN    AAAA    2606:2800:220:1:248:1893:25c8:1946

# CNAME record - domain alias
www.example.com.    IN    CNAME    example.com.

# MX record - mail server
example.com.    IN    MX    10 mail.example.com.

# TXT record - text information (commonly used for SPF, DKIM verification)
example.com.    IN    TXT    "v=spf1 include:_spf.google.com ~all"

# NS record - domain server
example.com.    IN    NS    ns1.example.com.

DNS Query Commands and Debugging

# Detailed DNS query using dig command

# Basic query
dig example.com

# Query specific record type
dig example.com MX
dig example.com TXT
dig example.com NS

# Query using specified DNS server
dig @8.8.8.8 example.com

# Trace query process
dig +trace example.com

# Reverse DNS lookup (IP to domain)
dig -x 93.184.216.34

# Using nslookup
nslookup example.com
nslookup -type=MX example.com

Recommended Tools

dig and nslookup are command-line DNS lookup tools. MXToolbox is an online DNS diagnostic tool. DNSChecker can check global DNS propagation status. Cloudflare DNS is a fast public DNS service.