Create Zone

Create zone files that servers resolve IP address from domain name.

[1] For zone, This example uses internal address [], domain name [], but please use your own one when you set config on your server.

[[email protected] ~]# vi /var/named/

$TTL 86400        IN            SOA (
                        2021102901    ; Serial
                        14400         ; Refresh
                        3600          ; Retry
                        1209600       ; Expire
                        86400         ; Minimum TTL

; Default Host        IN    A

; DNS Servers        IN    NS    IN    A

; Mail Servers        IN    MX      10    IN    A

; Main Section
www                     IN    CNAME

; SPF Record        IN    TXT     ("v=spf1 ip4: ~all")

   The zone file above contains the basic definitions for a domain. It assumes that the name server we configure is and the default email address is [email protected], and that the mail server and the server hosting the domain name are on the same ip address.

[2] We can check if there is an error in the region file we have written as follows.

[[email protected] ~]# named-checkzone /var/named/
zone loaded serial 2021102901

[3] We must specify the zone file we created as the zone in the main configuration.

[[email protected] ~]# vi /etc/named.conf
zone . IN {
        type            hint;
        file            "/var/named/";

zone IN {
        type            master;
        file            "/var/named/";

include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";

[4] We can restart the named service or activate it by reloading the configurations.

[[email protected] ~]# systemctl restart named


[[email protected] ~]# rndc reload
server reload successful

[5] Finally, let's verify the name presentation of our domain name.

[[email protected] ~]# dig
; EDNS: version: 0, flags:; udp: 4096
; COOKIE: f5cabc31fc6f12e3bc0b15e96154960209bdee746cba1f29 (good)
;                IN    A

;; ANSWER SECTION:        86400    IN    A

;; AUTHORITY SECTION:        86400    IN    NS

;; ADDITIONAL SECTION:    86400    IN    A
;; MSG SIZE  rcvd: 122