====== DNS Explained ======
The **Domain Name System (DNS)** is often described as the "phonebook of the Internet." It translates human-readable domain names (such as `example.com`) into IP addresses (such as `93.184.216.34`) that computers use to communicate.
Without DNS, users would have to remember the IP address of every website they visit.
-----
===== How DNS Works =====
When you enter a domain name into your browser, the following steps occur:
- **Resolver** (usually your ISP's DNS server or a public resolver such as Google DNS `8.8.8.8` or Cloudflare DNS `1.1.1.1`) receives the query.
- The resolver checks whether it already has the answer cached.
- If not cached, the resolver queries a **Root DNS Server**.
- The root server directs the resolver to the appropriate **Top-Level Domain (TLD) Server** (such as `.com`, `.org`, or `.ir`).
- The TLD server tells the resolver which **Authoritative DNS Server** is responsible for the domain.
- The authoritative server returns the requested DNS record (A, AAAA, MX, TXT, etc.).
- The resolver caches the answer according to its **TTL (Time To Live)** and returns it to your browser.
Browser
│
▼
Recursive Resolver
│
▼
Root Server
│
▼
TLD Server
│
▼
Authoritative DNS Server
│
▼
DNS Record
-----
===== Common DNS Record Types =====
^ Record ^ Purpose ^ Example ^
| **A** | Maps a hostname to an IPv4 address | `example.com → 93.184.216.34` |
| **AAAA** | Maps a hostname to an IPv6 address | `example.com → 2606:2800:220:1:248:1893:25c8:1946` |
| **CNAME** | Alias for another hostname | `www.example.com → example.com` |
| **MX** | Mail server for a domain | `10 mail.example.com` |
| **TXT** | Text information (SPF, DKIM, DMARC, ownership verification, etc.) | `v=spf1 include:_spf.example.com ~all` |
| **NS** | Authoritative name servers for a zone | `ns1.example.com` |
| **SOA** | Zone configuration and serial number | `ns1.example.com admin.example.com 2026072001` |
| **PTR** | Reverse DNS (IP → hostname) | `93.184.216.34 → example.com` |
| **CAA** | Specifies which Certificate Authorities may issue TLS certificates | `0 issue "letsencrypt.org"` |
-----
===== Recursive Resolver vs Authoritative Server =====
It is important to distinguish between these two server types.
^ Recursive Resolver ^ Authoritative Server ^
| Receives queries from users | Stores the official DNS records |
| Performs recursive lookups | Answers only for its own domains |
| Caches results | Does not perform recursion |
| Usually operated by ISPs or public DNS providers | Usually operated by the domain owner or DNS provider |
-----
===== What is an Authoritative DNS Server? =====
An **authoritative DNS server** stores the official DNS records for a domain.
Example:
example.com
│
└── ns1.example.com
├── A → 93.184.216.34
├── AAAA → 2606:...
├── MX → mail.example.com
├── TXT → v=spf1 include:_spf.example.com ~all
└── CAA → letsencrypt.org
Whenever DNS information changes, these servers are the source of truth.
-----
===== What is TTL? =====
**TTL (Time To Live)** specifies how long a DNS record may be cached before it must be queried again.
Example:
| TTL | Meaning |
| 300 | Cache for 5 minutes |
| 3600 | Cache for 1 hour |
| 86400 | Cache for 24 hours |
Short TTL values allow DNS changes to propagate more quickly but increase the number of DNS queries.
-----
===== Why do different DNS servers sometimes return different answers? =====
DNS responses may vary because:
* Different resolvers may still have cached records.
* CDN providers return different IP addresses based on the user's geographic location.
* DNS propagation may still be in progress after a recent change.
* Some providers implement GeoDNS or Anycast routing.
This is why querying multiple DNS servers is useful when troubleshooting DNS issues.
-----
===== DNS Propagation =====
After changing a DNS record, not all users will see the change immediately.
Propagation time depends on:
* The TTL of the previous record.
* Resolver cache expiration.
* ISP caching policies.
Although changes are published immediately on the authoritative server, recursive resolvers around the world may continue serving cached data until the TTL expires.
-----
===== Telenegar DNS Check =====
**Telenegar DNS Check** queries DNS records from multiple DNS providers and geographic locations, allowing you to:
* Compare responses from different DNS servers.
* Detect DNS propagation issues.
* Verify GeoDNS and CDN behavior.
* Query A, AAAA, MX, TXT, NS, SOA, PTR, CNAME, and other DNS record types.
Use our [[https://telenegar.ir/dnscheck/|DNS Check]] tool to investigate DNS resolution from multiple locations.
-----
{{tag>dns networking dnssec authoritative resolver propagation ttl}}