Create zone files that servers resolve IP address from domain name.
[1] For zone, This example uses internal address [192.168.122.2], domain name [futurelinux.org], but please use your own one when you set config on your server.
[root@futurelinux ~]# vi /var/named/futurelinux.org
$TTL 86400
futurelinux.org. IN SOA ns1.futurelinux.org. info.futurelinux.org. (
2021102901 ; Serial
14400 ; Refresh
3600 ; Retry
1209600 ; Expire
86400 ; Minimum TTL
)
; Default Host
futurelinux.org. IN A 192.168.122.2
; DNS Servers
futurelinux.org. IN NS ns1.futurelinux.org.
ns1.futurelinux.org. IN A 192.168.122.2
; Mail Servers
futurelinux.org. IN MX 10 mx1.futurelinux.org.
mx1.futurelinux.org. IN A 192.168.122.2
; Main Section
www IN CNAME futurelinux.org.
; SPF Record
futurelinux.org. IN TXT ("v=spf1 ip4:192.168.122.2 ~all")
The zone file above contains the basic definitions for a domain. It assumes that the name server we configure is ns1.futurelinux.org 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.
[root@futurelinux ~]# named-checkzone futurelinux.org /var/named/futurelinux.org
zone futurelinux.org/IN: loaded serial 2021102901
OK
[3] We must specify the zone file we created as the zone in the main configuration.
[root@futurelinux ~]# vi /etc/named.conf
...
zone . IN {
type hint;
file "/var/named/named.ca";
};
zone futurelinux.org IN {
type master;
file "/var/named/futurelinux.org";
};
include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";
[4] We can restart the named service or activate it by reloading the configurations.
[root@futurelinux ~]# systemctl restart named
or
[root@futurelinux ~]# rndc reload
server reload successful
[5] Finally, let's verify the name presentation of our domain name.
[root@futurelinux ~]# dig futurelinux.org
...
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
; COOKIE: f5cabc31fc6f12e3bc0b15e96154960209bdee746cba1f29 (good)
;; QUESTION SECTION:
;futurelinux.org. IN A
;; ANSWER SECTION:
futurelinux.org. 86400 IN A 192.168.122.2
;; AUTHORITY SECTION:
futurelinux.org. 86400 IN NS ns1.futurelinux.org.
;; ADDITIONAL SECTION:
ns1.futurelinux.org. 86400 IN A 192.168.122.2
...
;; MSG SIZE rcvd: 122