Networking Fundamentals

DNS Complete Guide — What is DNS and How Does It Work?

G Gurpreet Singh July 28, 2026 5 min read
DNS Complete Guide — What is DNS and How Does It Work?

What is DNS?

DNS (Domain Name System) is the internet’s phone book. It translates human-readable domain names (like www.google.com) into machine-readable IP addresses (like 142.250.80.46) that computers use to communicate. Without DNS, you would need to memorize IP addresses to visit every website — DNS makes the internet usable by humans.

DNS is a distributed, hierarchical database system operating at the Application layer (Layer 7) of the OSI model. It uses both UDP port 53 (for standard queries) and TCP port 53 (for zone transfers and large responses).

How DNS Works — Step by Step

When you type “www.networkingsignal.com” in your browser, here is exactly what happens:

  1. Browser cache check: Your browser checks its local cache. If it has recently resolved this domain, it uses the cached IP address.
  2. OS cache check: If not in browser cache, the OS checks the local DNS cache and the hosts file.
  3. Recursive resolver query: The OS sends a query to your configured DNS resolver (usually your ISP’s DNS server or a public resolver like 8.8.8.8).
  4. Root nameserver query: The recursive resolver queries a Root Nameserver (13 root server clusters globally) asking “who handles .com?”
  5. TLD nameserver query: The resolver queries the .com TLD (Top-Level Domain) nameserver asking “who handles networkingsignal.com?”
  6. Authoritative nameserver query: The resolver queries the authoritative nameserver for networkingsignal.com to get the actual IP address.
  7. Response returned: The IP address is returned to the browser, which then makes an HTTP/HTTPS connection to the web server.
  8. TTL caching: The resolver caches the response for the TTL (Time to Live) duration to speed up future lookups.

This entire process typically takes 20–120 milliseconds — fast enough to be imperceptible to users.

DNS Record Types

Record TypePurposeExample
AMaps domain to IPv4 addressnetworkingsignal.com → 192.0.2.1
AAAAMaps domain to IPv6 addressnetworkingsignal.com → 2001:db8::1
CNAMEAlias — points to another domainwww.example.com → example.com
MXMail exchange — email routingexample.com → mail.example.com
TXTText records (SPF, DKIM, verification)SPF record for email authentication
NSNameserver — delegates DNS authorityexample.com → ns1.cloudflare.com
PTRReverse DNS — IP to domain name192.0.2.1 → networkingsignal.com
SOAStart of Authority — zone infoPrimary nameserver, email, TTL defaults
SRVService location recordsSIP, XMPP, Teams services
CAACertificate Authority AuthorizationControls which CAs can issue SSL certs

Types of DNS Servers

Recursive Resolver (Recursive Nameserver)

The first DNS server your device contacts. It does the heavy lifting — querying root, TLD, and authoritative nameservers on your behalf and returning the final answer. Examples: 8.8.8.8 (Google), 1.1.1.1 (Cloudflare), your ISP’s DNS server.

Root Nameservers

There are 13 root nameserver clusters (A through M) distributed globally using anycast routing. They know where TLD nameservers are but don’t know individual domain IP addresses. Operated by ICANN, Verisign, and other organizations.

TLD Nameservers

Handle Top-Level Domains like .com, .org, .net, .uk. Operated by domain registries (Verisign operates .com and .net). They direct queries to the authoritative nameservers for specific domains.

Authoritative Nameservers

The final authority for a specific domain. They hold the actual DNS records (A, MX, CNAME, etc.) configured by the domain owner. Examples: Cloudflare, AWS Route 53, Google Cloud DNS, or your web host’s nameservers.

DNS Caching and TTL

To reduce DNS query traffic and speed up resolution, DNS responses are cached at multiple levels: browser, OS, recursive resolver. Each DNS record has a TTL (Time to Live) value in seconds that determines how long it can be cached. A TTL of 3600 means the record is cached for 1 hour. Low TTLs (60–300 seconds) are used when frequent changes are expected (failover, CDN switching). High TTLs (86400 seconds = 1 day) are used for stable records to reduce query load.

Best Public DNS Servers

ProviderPrimary DNSSecondary DNSFeature
Cloudflare1.1.1.11.0.0.1Fastest, privacy-focused
Google8.8.8.88.8.4.4Reliable, widely trusted
OpenDNS208.67.222.222208.67.220.220Content filtering available
Quad99.9.9.9149.112.112.112Security-focused, blocks malware
Comodo8.26.56.268.20.247.20Blocks malicious domains

DNS Security — Threats and Protections

DNS Spoofing / Cache Poisoning

An attacker injects false DNS records into a resolver’s cache, redirecting users to malicious websites. Protection: DNSSEC (DNS Security Extensions) cryptographically signs DNS records to prevent tampering.

DNS Hijacking

An attacker modifies DNS settings on a router or ISP level to redirect traffic. Use reputable public DNS servers and enable HTTPS-encrypted DNS (DoH) to prevent surveillance.

DNS Amplification DDoS

Attackers use open DNS resolvers to amplify attack traffic. Protection: configure DNS servers to only respond to authorized clients (no open resolvers).

DNS over HTTPS (DoH) and DNS over TLS (DoT)

Modern privacy protocols that encrypt DNS queries so ISPs and network observers cannot see which domains you are looking up. Supported by Cloudflare (1.1.1.1), Google (8.8.8.8), and modern browsers.

DNS Troubleshooting Commands

# Windows — Check DNS resolution
nslookup google.com
nslookup google.com 8.8.8.8

# Windows — Flush DNS cache
ipconfig /flushdns

# Linux/Mac — Check DNS resolution
dig google.com
dig @8.8.8.8 google.com

# Check DNS record types
dig MX gmail.com
dig A networkingsignal.com
dig NS networkingsignal.com

# Trace DNS resolution path
dig +trace google.com

Frequently Asked Questions

What is the fastest DNS server?

Cloudflare’s 1.1.1.1 is consistently ranked as the fastest public DNS resolver globally, with average response times of 11–14ms. Google’s 8.8.8.8 is slightly slower but equally reliable.

Should I change my DNS server?

Yes, in most cases. Your ISP’s DNS is often slower than public alternatives and may log your queries. Switching to 1.1.1.1 or 8.8.8.8 can improve browsing speed and privacy. Change DNS settings in your router’s admin panel (at 192.168.0.1 or your router’s IP) to apply it to all devices.

What is a DNS leak?

A DNS leak occurs when your DNS queries are sent to your ISP’s DNS servers instead of your VPN provider’s DNS servers, even when connected to a VPN. This can reveal your browsing activity despite using a VPN. Use a VPN that includes DNS leak protection and run a DNS leak test to verify.

How long do DNS changes take to propagate?

DNS propagation depends on the TTL of the changed records. With a 3600-second (1-hour) TTL, most users globally will see the new records within 1–4 hours. Full worldwide propagation can take up to 48 hours in rare cases, though 24 hours is more typical.

Related: OSI Model Guide | NAT Complete Guide | IP Address Guide | DHCP DORA Process | Subnet Calculator

GU
Written by

Gurpreet Singh

Hey! I"m Gurpreet Singh and I Have 7+ Years of experience in the Network & Security Domain as well as the Cloud Infra Domain. I am Certified with Cisco ( CCNA ), CheckPoint ( CCSA ), 1xAWS, 3xAZURE, and 3xNSE. So I love to share my tech knowledge with you.

Leave a Reply

Your email address will not be published. Required fields are marked *