DNS Management Guide
Zones, records, TTL, nameservers and dig queries explained with examples
DNS is one of the basic building blocks of the internet. Whenever a website is opened, an email is sent or an API is called, DNS is involved. This guide explains the main concepts (domain, nameserver, zone, DNS records, TTL and caching), shows simple examples and ends with how you manage DNS at OpusDNS.
All IP addresses in this guide come from ranges reserved for documentation (192.0.2.0/24, 198.51.100.0/24, 203.0.113.0/24 and 2001:db8::/32). The domains example.com, example.net and example.org are reserved for examples as well.
1. What is DNS?
DNS stands for Domain Name System. It works like the phone book of the internet. People use names that are easy to remember:
example.com www.example.com shop.example.com
Computers, however, communicate using IP addresses:
192.0.2.10 (IPv4) 2001:db8::10 (IPv6)
DNS translates domain names into IP addresses, for example:
example.com A 192.0.2.10
Without DNS, users would need to remember the IP address of every service they use.
2. Basic concepts and terminology
2.1 Domain
A domain is the human-readable name of an internet address, for example example.com, example.org or shop.example.net. The name shop.example.com is made of three parts, read from right to left:
com: the top-level domain (TLD)example: the second-level domain. Together with the TLD it forms the registered domainexample.com.shop: a subdomain
2.2 Nameserver
A nameserver answers DNS queries for a domain. When someone asks "Which IP address belongs to example.com?", the nameservers responsible for the domain are queried. For example, the domain example.com could use these nameservers:
ns1.example.net ns2.example.net
These nameservers hold the DNS configuration of the domain, its zone.
2.3 DNS zone
A DNS zone is the actual DNS configuration of a domain. It contains all DNS records, for example for websites, mail servers, subdomains, security settings and verifications:
example.com. A 203.0.113.10 www CNAME example.com. mail A 203.0.113.20
2.4 Subdomain
A subdomain is a name in front of a domain. It separates services, systems or environments under the same domain without registering new domains. Examples:
www.example.com shop.example.com api.example.com dev.example.com
A name can contain several levels of subdomains. In api.shop.example.com, shop is a subdomain of example.com and api is a subdomain of shop.example.com.
In DNS, a subdomain is simply another record in the same zone:
example.com. A 203.0.113.10 www CNAME example.com. shop A 203.0.113.20 api A 203.0.113.30
An A record points a name directly to an IPv4 address (here example.com to 203.0.113.10). A CNAME record makes a name an alias of another hostname instead of an IP address (here www.example.com to example.com).
Each subdomain can point to a different server, use a different service and have its own record type and TTL.
2.5 Common use cases
| Subdomain | Purpose |
|---|---|
www.example.com | Website |
api.example.com | Backend or API |
shop.example.com | Online shop |
dev.example.com | Development environment |
mail.example.com | Mail server |
3. DNS zones in detail
The zone is the central part of every DNS configuration. You can think of it as a technical configuration file.
3.1 Structure of a zone
A zone consists of DNS records for different names. The zone example.com could contain records for these names:
@ (the domain itself, example.com) www shop api mail _dmarc
Each name can point to a different system, have its own TTL and use different record types.
3.2 Core DNS terms
| Term | Meaning |
|---|---|
| Zone | Complete DNS configuration of a domain |
| Resource record (RR) | A single DNS record |
| RRset (resource record set) | All records with the same name, class and type, for example two A records for www with different IP addresses |
| Record type (RR type) | Type of the record, for example A, MX or TXT |
| Owner name | The name the record belongs to |
| TTL | How long resolvers may cache the record |
Example 1 (web)
- Zone:
example.com - Resource record:
www.example.com. 300 IN A 203.0.113.10 - RRset (two A records for the same name):
www.example.com. 300 IN A 203.0.113.10 www.example.com. 300 IN A 203.0.113.11
- Record type: A
- Owner name:
www.example.com - TTL: 300
Example 2 (web and mail)
- Zone:
example.net - Resource record:
example.net. 3600 IN A 198.51.100.10 - RRset (two MX records for the same name):
example.net. 3600 IN MX 10 mail.example.net. example.net. 3600 IN MX 20 backup.example.net.
- Record types: A, MX
- Owner name:
example.netfor all records shown.mail.example.netandbackup.example.netare the targets of the MX records, not owner names. - TTL: 3600
3.3 Other terms you will see
DNS terms vary depending on context and tool:
| Context | Term used | Meaning |
|---|---|---|
| RFCs and DNS standards | Resource record (RR) | Formal term of the DNS specification |
| Zone files (BIND style) | DNS record | Common configuration term |
| Cloud providers | DNS entry, record set | Terms used in their APIs |
| DNS engineering and operations | RR, RRset | Technical terms |
| DNS management dashboards | Record, DNS record | Simplified term for users |
3.4 TTL (time to live)
The TTL defines how long a resolver may cache a DNS record before it must ask the authoritative nameserver again (see section 4). A resolver is the DNS server that performs the lookup on behalf of clients, usually run by your internet provider, your company network or a public DNS service such as 1.1.1.1 or 8.8.8.8. It first checks its cache. If the TTL of a cached answer has not expired, it returns that answer immediately. Otherwise it asks the authoritative nameserver for the current data.
This also means: after you change a record, resolvers that have cached the old answer keep using it until its TTL expires.
Practical recommendations (rule of thumb)
| Situation | TTL | Why |
|---|---|---|
| Website that changes often (deployments, migrations, A/B tests) | 60 to 300 seconds | Changes spread fast, but there are more DNS queries. |
| New website, initial setup, go-live phase | 300 to 600 seconds | Flexible while you still make changes. Increase later. |
| Stable production website (rare changes) | 3600 to 14400 seconds (1 to 4 hours) | Good balance between performance and flexibility. |
| Very stable systems (for example landing pages) | 86400 seconds (24 hours) | Maximum caching, minimal DNS load. |
| APIs and apps with dynamic infrastructure (autoscaling, failover) | 60 to 300 seconds | Needed for fast failover and infrastructure changes. |
| Mail records (MX, and TXT records for SPF and DKIM) | 3600 to 86400 seconds | Usually stable, so a higher TTL is preferred. |
At OpusDNS, new records get a TTL of 3600 seconds (1 hour) by default. You can change it per record.
3.5 Common DNS record types
| Type | Full name | Purpose |
|---|---|---|
| A | Address record | Points a name to an IPv4 address |
| AAAA | IPv6 address record | Points a name to an IPv6 address |
| CNAME | Canonical name record | Makes a name an alias of another hostname (not for the domain itself) |
| ALIAS | Alias record | Provider-specific type, not a standard DNS type. At OpusDNS it points the domain itself to another hostname. Not available in zones with DNSSEC enabled. |
| MX | Mail exchange record | Names the mail servers of a domain |
| TXT | Text record | Free text, for example SPF, DKIM, DMARC and verifications |
| NS | Name server record | Names the nameservers responsible for a zone or delegates a subdomain |
| SOA | Start of authority | Administrative data of the zone |
| PTR | Pointer record | Reverse DNS, from IP address to hostname |
| SRV | Service record | Host and port of a service |
| CAA | Certification Authority Authorization | Names the certificate authorities allowed to issue certificates |
| HTTPS, SVCB | Service binding records | Connection information for a service, for example supported protocols |
| TLSA | TLS authentication record | Links a TLS certificate or key to a name (DANE) |
| DS | Delegation signer | Links a DNSSEC-signed zone to its parent zone |
| DNSKEY | DNS public key record | Public key of a DNSSEC-signed zone |
| NAPTR | Naming authority pointer | Rules for mapping names to services |
Which types you can create at OpusDNS, with examples: Supported DNS Record Types (DNS RR types).
3.6 Complete example zone
$ORIGIN example.com.
@ 3600 IN SOA ns1.example.net. hostmaster.example.com. (
2026050701 ; Serial
3600 ; Refresh
900 ; Retry
1209600 ; Expire
300 ; Negative cache TTL
)
@ 86400 IN NS ns1.example.net.
@ 86400 IN NS ns2.example.net.
@ 300 IN A 203.0.113.10
www 300 IN CNAME example.com.
mail 3600 IN A 203.0.113.20
@ 3600 IN MX 10 mail.example.com.
@ 3600 IN TXT "v=spf1 mx -all"
_dmarc 3600 IN TXT "v=DMARC1; p=reject"
4. Querying DNS records with dig
dig (Domain Information Groper) is a standard command-line tool that queries DNS servers directly. It is commonly used for troubleshooting and for checking DNS configurations.
A simple query for an A record:
dig example.com
The answer section shows the name, the remaining TTL, the record type and the value, for example:
example.com. 300 IN A 203.0.113.10
You can also ask for specific record types:
dig example.com A dig example.com AAAA dig example.com MX dig example.com TXT dig example.com NS
Authoritative nameservers hold the official version of a domain's DNS data (the zone). They are the source of truth for a domain and do not answer from a cache. When you query them directly, you bypass resolvers and their caches. This is the best way to check whether a DNS change has been applied at the source.
To query the OpusDNS nameservers directly:
dig @ns1.opusdns.com yourdomain.com dig @ns2.opusdns.net yourdomain.com
Replace yourdomain.com with a zone hosted at OpusDNS. For zones that are not hosted at OpusDNS, our nameservers answer with REFUSED. If your domain uses vanity nameservers, you can query those names instead.
5. Managing DNS at OpusDNS
- Create a zone for your domain: Creating DNS Zones: Setup, Import and Domain Transfers
- Find and edit your zones: DNS Zone Detail Page: Managing Records and Zones
- Add records step by step: Adding DNS Records: Record Types Guide
- Set the nameservers of your domain: Configuring Nameservers for Your Domain
- How nameservers and zones work together: Understanding OpusDNS Nameservers and Their Connection to DNS Zones
- Use nameserver names of your own domain: Setting Up Vanity Nameservers
- Secure your zone with DNSSEC: Configuring DNSSEC for Your Domain and DNS Zone