4 min read

Understanding DNS Records in BIND Format

We used AI while writing this content.

Supported Platforms

| |
| |
| BIND 9 | ✅ |
| BIND 8 | ✅ |
| Other DNS servers | ⚠️ (syntax may vary) |

What is BIND Format?

BIND (Berkeley Internet Name Domain) is the most widely used DNS server software on the Internet. Its zone file format has become the de facto standard for DNS record configuration. Understanding BIND format is essential for managing DNS zones, whether you're running your own nameserver or configuring records through a DNS provider.

Basic Syntax

1. Zone file structure

A BIND zone file contains DNS resource records (RRs) in a specific format:

name    TTL    class    type    rdata

Note: The TTL and class fields are optional if defaults are set. Most commonly, you'll see just the name, type, and data.

2. Common directives

$ORIGIN example.com.
$TTL 86400

@    IN    SOA    ns1.example.com. admin.example.com. (
                  2025120201  ; Serial
                  3600        ; Refresh
                  1800        ; Retry
                  604800      ; Expire
                  86400 )     ; Minimum TTL

     IN    NS     ns1.example.com.
     IN    NS     ns2.example.com.

Key points:

  • $ORIGIN sets the default domain suffix
  • $TTL defines the default Time To Live
  • @ represents the origin (zone name)
  • IN stands for Internet class (almost always used)

3. Essential record types

A Record (IPv4 Address)

www         IN    A       192.168.1.100
blog        IN    A       192.168.1.101
@           IN    A       192.168.1.1

Maps a hostname to an IPv4 address.

AAAA Record (IPv6 Address)

www         IN    AAAA    2001:db8::1
mail        IN    AAAA    2001:db8::2

Maps a hostname to an IPv6 address.

CNAME Record (Canonical Name)

www         IN    CNAME   example.com.
ftp         IN    CNAME   www.example.com.

Important: A CNAME creates an alias. The target must be a fully qualified domain name (FQDN) ending with a dot.

MX Record (Mail Exchange)

@           IN    MX      10 mail1.example.com.
@           IN    MX      20 mail2.example.com.

Specifies mail servers for the domain. Lower priority numbers are preferred.

TXT Record (Text)

@           IN    TXT     "v=spf1 mx a ip4:192.168.1.0/24 -all"
_dmarc      IN    TXT     "v=DMARC1; p=reject; rua=mailto:dmarc@example.com"

Stores arbitrary text data, commonly used for SPF, DKIM, and DMARC records.

NS Record (Name Server)

@           IN    NS      ns1.example.com.
@           IN    NS      ns2.example.com.
subdomain   IN    NS      ns1.another.com.

Delegates a zone or subdomain to specific nameservers.

PTR Record (Pointer)

100.1.168.192.in-addr.arpa.    IN    PTR    www.example.com.

Used for reverse DNS lookups (IP to hostname).

SRV Record (Service)

_http._tcp    IN    SRV    10 60 80 server1.example.com.
_xmpp._tcp    IN    SRV    10 40 5222 xmpp.example.com.

Format: priority weight port target

4. Advanced features

Using shortcuts

; Without $ORIGIN set, use fully qualified names:
www.example.com.    IN    A    192.168.1.100

; With $ORIGIN example.com. set:
www                 IN    A    192.168.1.100

; @ represents the current origin:
@                   IN    A    192.168.1.1

Multiple records of the same type

@    IN    A    192.168.1.1
@    IN    A    192.168.1.2
@    IN    A    192.168.1.3

This creates round-robin DNS for load distribution.

Using parentheses for readability

@    IN    SOA    ns1.example.com. admin.example.com. (
                  2025120201    ; Serial number
                  3600          ; Refresh (1 hour)
                  1800          ; Retry (30 minutes)
                  604800        ; Expire (1 week)
                  86400 )       ; Minimum TTL (1 day)

Parentheses allow splitting long records across multiple lines.

Comments

; This is a comment
www    IN    A    192.168.1.100    ; Inline comment

Comments start with a semicolon.

5. Complete example zone file

$ORIGIN example.com.
$TTL 86400

@    IN    SOA    ns1.example.com. admin.example.com. (
                  2025120201
                  3600
                  1800
                  604800
                  86400 )

; Name servers
@              IN    NS     ns1.example.com.
@              IN    NS     ns2.example.com.

; A records
@              IN    A      192.168.1.1
www            IN    A      192.168.1.100
mail           IN    A      192.168.1.50
ns1            IN    A      192.168.1.10
ns2            IN    A      192.168.1.11

; AAAA records
@              IN    AAAA   2001:db8::1
www            IN    AAAA   2001:db8::100

; CNAME records
ftp            IN    CNAME  www.example.com.
webmail        IN    CNAME  mail.example.com.

; MX records
@              IN    MX     10 mail.example.com.

; TXT records
@              IN    TXT    "v=spf1 mx a ip4:192.168.1.0/24 -all"
_dmarc         IN    TXT    "v=DMARC1; p=quarantine; rua=mailto:dmarc@example.com"

Common Pitfalls

Don't forget the trailing dot

; Wrong - will be interpreted as relative to $ORIGIN:
www    IN    CNAME    target.com

; Correct - fully qualified:
www    IN    CNAME    target.com.

Update the serial number

Every time you modify a zone file, increment the serial number. Common format: YYYYMMDDNN (year, month, day, revision number).

Test before deploying

named-checkzone example.com /path/to/zone/file

Always validate your zone file syntax before loading it into production.

Tools and Resources

Command-line utilities

  • named-checkzone - Validate zone file syntax
  • named-checkconf - Validate BIND configuration
  • dig - Query DNS records
  • nslookup - Query DNS records (legacy)
  • host - Simple DNS lookup utility

Online tools

Copyleft Statement

Renoncé du droit d'auteur

Much of our content is freely available under the Creative Commons BY-NC-ND 4.0 licence, which allows free distribution and republishing of our content for non-commercial purposes, as long as Ronzz.org is appropriately credited and the content is not being modified materially to express a different meaning than it is originally intended for. It must be noted that some images on Ronzz.org are the intellectual property of third parties. Our permission to use those images may not cover your reproduction. This does not affect your statutory rights.

Nous mettons la plupart de nos contenus disponibles gratuitement sous la licence Creative Commons By-NC-ND 4.0, qui permet une distribution et une republication gratuites de notre contenu à des fins non commerciales, tant que Ronzz.org est correctement crédité et que le contenu n'est pas modifié matériellement pour exprimer un sens différent que prévu à l'origine.Il faut noter que certaines images sur Ronzz.org sont des propriétés intellectuelles de tiers. Notre autorisation d'utiliser ces images peut ne pas couvrir votre reproduction. Cela n'affecte pas vos droits statutaires.