# DNS and Domain Names

> How DNS finds the IP address behind a name like example.com. What a resolver does, why answers are kept for a while, and how to look one up.

**Course:** [Computer Networking](https://learn.benibix.com/learn/infrastructure-networking)  
**Time:** 11 min

**After this lesson you can:**

- Explain what DNS does for a browser
- Look up a name with dig
- Say why a DNS change takes time to reach everyone

## How a name becomes an IP address

DNS, the domain name system, finds the IP address behind a name. You type a name, but a packet can only go to a number. So before anything loads, your device asks DNS for the number. The answer usually comes back in a few thousandths of a second.

Your device asks a resolver, a DNS service run by your internet provider or a public one. If the resolver does not know the answer, it asks the servers that do, step by step. First it asks which servers handle .com. Then it asks those servers which ones handle example.com. Those give the final answer.

The answer is a DNS record. An A record holds the common kind of IP address. An AAAA record holds the longer IPv6 kind. Other kinds point one name at another, or say which server takes the email for a name.

Every record carries a number of seconds that says how long it may be kept. A resolver keeps the answer for that long and gives the same one to everyone who asks. That is why most lookups are almost instant. It is also why a change does not reach everyone at once.

DNS is like asking a friend for a phone number. If they know it, they tell you. If not, they ring someone who does and remember it for next time. After a while they forget, in case the number has changed.

You can ask DNS yourself. The dig command prints the records for a name. On Windows, nslookup does the same job. It is the first tool to reach for when a site works for one person and not another.

A common mistake is to change a record and expect the whole world to see it at once. A resolver that asked an hour ago may keep the old answer until its time runs out. Lower that time to a few minutes a day before a move. Raise it again once the move is done.

```console
$ dig +short emmas-shop.com
203.0.113.10
```
One name in, one address back. With no +short, dig also prints how many seconds the answer may be kept.

![Three boxes. The browser, which wants emmas-shop.com, asks a DNS resolver what the number is. The resolver asks the servers that know, keeps the answer a while, and replies 203.0.113.10. A curved arrow then shows the browser connecting to the shop's server at 203.0.113.10. A note says the first two steps are skipped when a copy of the answer is still kept from last time.](https://learn.benibix.com/diagrams/infc-dns-lookup.svg)

### Example: A shop moves to a new server

Jack moves his shop to a new server with a new address. The day before, he lowers the record's time from 24 hours to 5 minutes.

On moving day he changes the A record. Within about 5 minutes, almost every visitor reaches the new server. The next day he sets the time back to 24 hours.

**Words in this lesson:** [Domain Name System (DNS)](https://learn.benibix.com/term/infrastructure/dns), [DNS Resolver](https://learn.benibix.com/term/infrastructure/dns-resolver)

**Question:** Why does a DNS change not reach everyone straight away?

**Answer:** A resolver keeps the old answer until the time on the record runs out. Each record says how long it may be kept. A resolver that fetched it earlier keeps handing out the old answer until that time is up.

---

Source: https://learn.benibix.com/learn/infrastructure-networking/dns-and-domain-names
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-19
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
