Kahibaro
Discord Login Register

Understanding DNS

DNS in the Big Picture

DNS (Domain Name System) is a distributed, hierarchical database that maps human‑readable names (like www.example.com) to technical identifiers (like IP addresses).

At a server‑administration level, you care about DNS because:

This chapter focuses on understanding how DNS works conceptually and operationally so that later chapters (e.g., “Setting up BIND”) make sense.

Fundamental DNS Concepts

DNS as a Distributed Database

DNS is not one big central database; it is:

DNS stores resource records (RRs). Each record is identified by:

Conceptually, a record looks like:

$$
\text{name} \quad \text{TTL} \quad \text{class} \quad \text{type} \quad \text{value}
$$

Example:

www.example.com. 3600 IN A 203.0.113.10

The DNS Hierarchy

The DNS namespace is a tree:

A fully qualified domain name (FQDN) always conceptually ends with a dot, e.g. www.example.com.
Clients often omit the trailing dot; resolvers handle that.

Domains vs Zones

These are often confused:

A zone:

Examples:

Zones allow delegation of responsibility: your registrar delegates the example.com zone to your nameservers; you can delegate us.example.com to another team/provider.

How a DNS Query Works

The Main Players

For a typical DNS lookup, these roles are involved:

Step‑by‑Step Resolution

When a client needs www.example.com:

  1. Client → Recursive Resolver
    Client asks: “What is www.example.com?”
  2. Cache Check
    Resolver checks if it already has a fresh answer in cache.
    • If yes, it replies immediately.
    • If no, it starts a recursive resolution.
  3. Ask Root Servers
    Resolver asks a root server: “Who knows .com?”
    Root replies with a referral to the .com TLD nameservers.
  4. Ask TLD Servers
    Resolver asks .com servers: “Who is authoritative for example.com?”
    TLD servers reply with NS records (nameservers for example.com) plus their IP addresses (glue records, discussed later).
  5. Ask Authoritative Servers for example.com
    Resolver asks those authoritative servers: “What is the A record for www.example.com?”
    Nameserver responds with the IP (and TTL).
  6. Resolver Caches and Returns Answer
    Resolver stores the answer in cache for the TTL, then replies to the client.

On subsequent queries within the TTL, steps 3–5 are skipped due to caching.

Recursive vs Iterative Queries

Authoritative servers typically do not accept recursive queries (and should not, for security reasons).

Caching and TTL

Each DNS record has a TTL (seconds). During that time, a resolver can reuse the answer from cache without querying the authoritative server again.

Implications for administration:

You can use this operationally:

Core DNS Record Types for Servers

DNS uses many record types; as a server admin, these matter most:

A and AAAA Records

Examples:

www.example.com. 3600 IN A 203.0.113.10
www.example.com. 3600 IN AAAA 2001:db8::10

When load balancing with DNS, you can have multiple A/AAAA records for the same name.

CNAME Records

Canonical Name: an alias pointing to another name (canonical target).

Example:

www.example.com. 3600 IN CNAME web-frontend-1.example.com.

Rules and caveats:

MX Records

Mail Exchanger: tells other mail servers where to send email for your domain.

Example:

example.com. 3600 IN MX 10 mail1.example.com.
example.com. 3600 IN MX 20 mail2.backup-mx.tld.

Key points:

NS Records

Name Server: specifies authoritative servers for a zone (or sub‑zone).

Example (in the parent zone):

example.com. 172800 IN NS ns1.dns-provider.net.
example.com. 172800 IN NS ns2.dns-provider.net.

SOA Record

Start of Authority: metadata for a zone. There is exactly one SOA record per zone, at the zone apex:

Example:

`example.com. 3600 IN SOA ns1.example.com. admin.example.com. (
2025121201 ; serial
7200 ; refresh
3600 ; retry
1209600 ; expire
3600 ) ; minimum/negative TTL
`

Fields:

As an admin, correct serial handling is important: secondaries won’t pick up changes if serial doesn’t increase.

TXT Records

Originally arbitrary text; now heavily used for:

Example:

example.com. 3600 IN TXT "v=spf1 mx -all"

PTR Records (Reverse DNS)

While forward DNS maps name → IP, reverse DNS maps IP → name using PTR records in special reverse zones:

Example (IPv4):

IP 203.0.113.1010.113.0.203.in-addr.arpa.

Record:

10.113.0.203.in-addr.arpa. 86400 IN PTR web-01.example.com.

Operational relevance:

Zones, Delegation, and Glue

Zone Apex and Subdomains

The zone apex is the root name of a zone, e.g.:

A zone may contain records for subdomains, like:

www.example.com.
api.example.com.
eu.example.com.

These names can be answered by the same zone, or you can delegate a subtree as a separate zone.

Delegation

Delegation is how the DNS hierarchy is split among different authorities.

Example:

Steps conceptually:

  1. In the example.com zone, you add NS records for eu.example.com that point to the nameservers for that subzone.
  2. The authoritative servers for eu.example.com serve their own zone file with their own SOA, etc.

Clients resolving host.eu.example.com will:

Delegation is fundamental when splitting public/internal DNS, or delegating reverse DNS sub‑blocks to customers.

Glue Records

Glue is an A/AAAA record placed in the parent zone to break circular dependencies.

Example:

You register example.com and want to use:

as nameservers for the zone.

Problem:
To resolve ns1.example.com, you need to query example.com nameservers, but to find example.com nameservers, you need ns1.example.com’s IP. Circular.

Solution:
At the TLD level (.com), your registrar adds:

Now resolvers can find ns1.example.com without first resolving example.com.

Operational note: Glue is managed via your domain registrar interface, not in your own zone file alone.

DNS Resolution Patterns for Services

Web Services

Typical setup:

You might use:

Consider:

Mail Services

Key DNS aspects for mail:

While configuration details belong in mail‑specific chapters, understanding the DNS foundation is essential for troubleshooting deliverability.

Internally Scoped DNS

In corporate or data center environments:

Understanding that different resolvers (internal vs external) see different DNS views is crucial for diagnosing “it works on the server but not from the internet” scenarios.

DNS Security and Reliability Concepts

Common DNS Threats (Conceptual)

At this stage, you should be able to recognize these as risks and tie them to later mitigation techniques.

DNSSEC (High‑Level View)

DNSSEC (DNS Security Extensions) adds authenticity and integrity to DNS data using digital signatures:

Key point: DNSSEC protects against tampering and spoofing, but not against all DNS‑related problems (e.g., misconfiguration, denial of service).

Redundancy and Anycast

To make DNS resilient:

As an admin, you typically don’t implement anycast yourself unless at ISP scale, but you should understand that a single IP in NS records may represent multiple physical servers.

Practical Troubleshooting Mindset

Before configuring servers (covered in later chapters), it helps to think about how to reason about DNS issues.

Key questions when something “doesn’t resolve”:

  1. Which resolver am I using?
    • Check /etc/resolv.conf or system resolver configuration.
    • Different networks/clients may see different DNS views.
  2. Is the problem forward or reverse DNS?
    • Name → IP vs IP → name.
  3. Where does resolution break?
    • At the root, TLD, parent zone, or authoritative zone?
    • Is delegation correct (NS and glue)?
  4. Is it caching‑related?
    • Are you waiting for a TTL to expire?
    • Did you increase the serial in the SOA?
  5. Do different resolvers see different answers?
    • Hinting at split‑horizon DNS, propagation delay, or a particular resolver’s cache.

Later, when you learn dig, nslookup, and other tools, you’ll use this conceptual model to interpret their output.

Summary

By understanding:

you’ll be prepared to:

Subsequent chapters on DNS server configuration and troubleshooting will build on these concepts.

Views: 24

Comments

Please login to add a comment.

Don't have an account? Register now!