Example of a DNS domain zone in BIND:

  • Use ";" as comment.
  • For domain, you can either use the "@" sign or the domain name with dot at the end. For example, either use: domain.com. (with dot at the end) or the @ sign.
  • For host like www or ftp or other hosts, you can either enter it as is without dot at the end or use the fully qualified domain with dot at the end. So www or www.domain.com. means the same.
  • I used short refresh times (like 600 seconds = 10 minutes) so incase the domain records gets updated often, the changes propagated through other DNS servers quicker.
  • For most situations, DNS servers are provided by ISPs and Domain Name Registrars for example: ns1.comentum.com ns2.comentum.com, depending on who is running the DNS servers for a particular domain

; This is a comment in zone file
domain.com. 7200   IN  SOA ns1.domain.com.     hostmaster.domain.com.(
                2014062301   ;Serial Number
                7200         ;Refresh - 2 hours
                7200         ;Retry - 2 hours
                604800       ;Expire
                600          ;Minimum - 10 minutes
)

; in below example, we could have used the @ sign instead of domain.com. with dot at the end - it is the same:
domain.com.                600     IN      NS       ns1.domain.com.    
domain.com.                600     IN      NS       ns2.domain.com. 


;in below example, we could have used ns1 (or ns2) instead of ns1.domain.com. with dot at the end - it is the same:
ns1.domain.com.            600     IN      A       192.168.1.10  
ns2.domain.com.            600     IN      A       192.168.2.10 

domain.com.                600     IN      A        192.168.1.12 
;in below example, we could have used www.domain.com. instead of www - it is the same:       
www                        600     IN      CNAME    domain.com. 

; Below I used @ sign instead of domain.com. for showing you more examples:
@                          600     IN      MX       10  mx1.domain.com.
@                          600     IN      MX       20  mx2.domain.com.

; Below I used mx1 (and mx2) instead of mx1.domain.com. (and mx2.comentum.com) for showing you more examples:
mx1                        600     IN      A       192.168.1.11 
mx2                        600     IN      A       192.168.2.11

; Below I could have used the @ sign instead of domain.com. - it means the same in the DNS world:
domain.com.                600     IN      TXT      "v=spf1 include:domain.com ip4:192.168.1.5 ~all"