Computers connect to each other using IP addresses such as 192.0.2.10 (IPv4) or 2001:db8::10 (IPv6). People prefer names like example.com. The Domain Name System (DNS) is the global directory that translates one into the other — and when it fails, almost everything on a network appears broken.
What happens when you visit a website
When you type www.example.com into a browser, this is what happens behind the scenes:
- Local cache. Your browser and operating system check whether they already know the answer from a recent lookup.
- Recursive resolver. If not, your computer asks its configured DNS server — usually your router, your company's domain controller or a public resolver. This recursive resolver does the hard work on your behalf.
- Root servers. The resolver asks a root server where to find
.com. The root server replies with the servers responsible for.com. - TLD servers. The resolver asks a
.comserver, which replies with the authoritative name servers forexample.com. - Authoritative server. The resolver asks the authoritative server for
www.example.comand receives the IP address. - Answer and cache. The resolver returns the address to your computer, and both cache it for the length of the record's TTL.
This normally takes a few milliseconds, and most lookups are answered from a cache at step 1 or 2.
Common DNS record types
| Record | Purpose | Example value |
|---|---|---|
| A | Maps a name to an IPv4 address | 192.0.2.10 |
| AAAA | Maps a name to an IPv6 address | 2001:db8::10 |
| CNAME | Makes one name an alias of another | www → example.com |
| MX | Lists the mail servers for a domain, with priority | 10 mail.example.com |
| TXT | Free text, used for SPF, DKIM, DMARC and domain verification | v=spf1 include:… -all |
| NS | Lists the authoritative name servers for a domain | ns1.example.net |
| SOA | Administrative details for a zone (primary server, serial number) | — |
| PTR | Reverse lookup — maps an IP address back to a name | mail.example.com |
| SRV | Locates services such as Active Directory domain controllers | _ldap._tcp.example.com |
Testing DNS from the command line
Windows PowerShell
# Look up an A record
Resolve-DnsName example.com -Type A
# Look up mail servers
Resolve-DnsName example.com -Type MX
# Ask a specific DNS server, bypassing your configured one
Resolve-DnsName example.com -Server 1.1.1.1Command Prompt (Windows, macOS, Linux)
nslookup is available almost everywhere:
nslookup example.com
nslookup -type=mx example.com
nslookup example.com 1.1.1.1Linux and macOS
dig gives the most detail. The +trace option shows every step from the root servers down:
dig example.com A
dig example.com MX +short
dig example.com +traceClearing the DNS cache
If a record was changed recently but your computer still uses the old address, clear the local cache:
ipconfig /flushdnsOn Windows, ipconfig /displaydns shows what is currently cached.
When DNS is the problem
A quick test tells you whether DNS is the cause of a connectivity issue: if you can reach a server by IP address but not by name, DNS is at fault. Our network troubleshooting guide walks through that process step by step.