DNS
Domain Name System (DNS)
The Domain Name System (DNS) is the internet's phone book. It translates human-friendly names such as onsoftware.engineering into IP addresses such as 203.0.113.42.
1. The basic idea
When you enter:
https://onsoftware.engineeringyour computer needs to discover the server's IP address before it can connect.
DNS therefore sits before the actual HTTP connection.
2. What happens when you type a URL?
Typically:
- The browser checks its DNS cache.
- The operating system checks its DNS cache.
- The configured DNS resolver is queried.
- If the resolver doesn't already know the answer, it performs a DNS lookup.
- The resolver eventually obtains the IP address.
- The result is cached for a period of time.
- The browser connects to the IP address.
Browser
|
v
OS DNS cache
|
v
DNS Resolver
|
+-- Root DNS server
|
+-- .engineering DNS server
|
+-- Authoritative DNS server
|
v
203.0.113.423. The four important DNS players
1. DNS client
Usually your operating system or browser.
It asks:
"What IP address belongs to this domain?"
2. Recursive resolver
The resolver does the work on your behalf.
Examples include:
- Your ISP's DNS resolver
- Google Public DNS
- Cloudflare DNS
- A corporate DNS resolver
The client normally talks only to the resolver.
3. Root DNS servers
The root system doesn't normally know the IP address of your website.
Instead, it knows who is responsible for each top-level domain (TLD).
For example:
. <- root
+-- engineering <- TLD4. Authoritative DNS server
This is the final authority for a domain.
It contains records such as:
onsoftware.engineering -> 203.0.113.424. How recursive resolution works
Suppose the resolver receives:
What is the IP address of www.example.com?It can work down the DNS hierarchy:
The important point is that the resolver performs the recursion.
Your computer doesn't normally contact all these servers itself.
5. DNS is hierarchical
DNS names form a hierarchy from right to left:
www.onsoftware.engineering
| | |
| | +-- Top-level domain
| +------------- Domain
+------------------ Subdomain / hostMore precisely:
www.onsoftware.engineering.
^
rootThe final . represents the DNS root, although it is normally omitted.
6. DNS records
DNS isn't just about IP addresses. A domain can have many different types of records.
| Record | Purpose | Example |
|---|---|---|
A | IPv4 address | 93.184.216.34 |
AAAA | IPv6 address | 2001:db8::1 |
CNAME | Alias | www -> example.com |
MX | Mail server | mail.example.com |
TXT | Arbitrary text | SPF/DKIM verification |
NS | Authoritative name server | ns1.example.com |
CAA | Allowed certificate authorities | letsencrypt.org |
For example:
example.com
A -> 93.184.216.34
MX -> mail.example.com
CNAME -> www.example.com7. Why DNS is fast
DNS would be painfully slow if every request required a complete lookup.
Instead, DNS uses caching.
A response has a TTL (Time To Live):
example.com
A
93.184.216.34
TTL = 3600 secondsThe resolver can cache the answer for one hour.
During that time:
Client --> Resolver
|
+-- cached answerNo root, TLD, or authoritative server needs to be contacted.
8. DNS and changing IP addresses
Suppose your server moves:
Old server
203.0.113.42
|
v
New server
198.51.100.17You change the A record:
example.com -> 198.51.100.17But clients may continue receiving the old address until their cached DNS entry expires.
That's why DNS changes are not necessarily instantaneous.
9. DNS over UDP and TCP
Traditional DNS usually uses:
UDP port 53TCP port 53 is also used when necessary, for example for larger responses or certain DNS operations.
Modern encrypted alternatives include:
- DoH — DNS over HTTPS
- DoT — DNS over TLS
These encrypt the DNS traffic between the client and resolver.
10. The whole picture
Putting everything together:
The key distinction is:
DNS finds the server. HTTP/HTTPS talks to the server.
11. The mental model
You can think of DNS like a chain of directories:
"What is onsoftware.engineering?"
|
v
Root
"Who handles .engineering?"
|
v
TLD
"Who handles onsoftware.engineering?"
|
v
Authoritative DNS
"The address is 203.0.113.42"
|
v
Browser
"Now I can connect."Once you understand recursive resolvers, DNS hierarchy, authoritative servers, records, and caching, most of DNS becomes straightforward.