Sub topic 8
DNS: turning names into addresses
This chapter assumes you know what an IPv4 address is, how DHCP hands out settings, and how to open a command prompt. It covers what DNS does, the record types the A+ Core 1 exam names, and how to separate DNS failures from other connectivity failures.
What DNS does
The Domain Name System (DNS) is a distributed directory that maps names such as example.com to IP addresses. People remember names. Routers and computers need addresses. DNS translates between them.
A device usually learns its DNS server addresses from DHCP. On a SOHO network, the router often passes its own address as the DNS server and forwards your queries to the internet service provider (ISP) or to a public resolver.
How a lookup works
- The computer checks its local DNS cache and the hosts file.
- If there is no answer, it asks the configured DNS server, called a resolver.
- The resolver answers from its own cache or queries other DNS servers until it finds the authoritative server for the domain.
- The answer returns to the computer, which caches it for a time set by the record's time to live (TTL).
Common record types
| Record | Purpose |
|---|---|
| A | Maps a name to an IPv4 address |
| AAAA | Maps a name to an IPv6 address |
| CNAME | Makes one name an alias of another name |
| MX | Names the mail server for a domain |
| TXT | Holds text, often used for email protection such as SPF, DKIM, and DMARC |
DNS normally uses port 53, over UDP for ordinary queries and TCP for large responses and zone transfers.
Testing DNS with nslookup
The nslookup command queries a DNS server directly.
nslookup example.comThe output shows which server answered, then the name and its address. You can also ask a specific server by adding its address, such as nslookup example.com 8.8.8.8. If that works while your default server fails, the problem lies with your configured DNS server.
Separating DNS problems from connectivity problems
The key symptom is a site that fails by name but works by address. Test in this order:
ping 8.8.8.8succeeds. Basic internet connectivity works.ping example.comfails with "could not find host". Name resolution is broken.nslookup example.comtimes out or returns an error. The DNS server is unreachable or not answering.
Common fixes:
- Check the DNS addresses with
ipconfig /all. - Renew the DHCP lease so the client gets correct DNS settings.
- Clear stale cached answers with
ipconfig /flushdns. - Set a different DNS server on the router or the adapter.
ipconfig /flushdnsExercise
A user can open a website by typing its IP address but not by typing its name. ping 8.8.8.8 succeeds. Which service is most likely failing, and which command confirms it?
Show answer
DNS name resolution is failing. Running nslookup on the site's name confirms it, because it will time out or return an error while pinging an IP address still works.
Exercise
Which DNS record type maps a name to an IPv6 address, and which maps one name to another name?
Show answer
An AAAA record maps a name to an IPv6 address. A CNAME record makes one name an alias for another name.