CentOS配置named作为DNS解析服务

0

yum install bind bind-utils

firewall-cmd --permanent --add-service=dns
firewall-cmd --reload

vim /etc/named.conf
---
listen-on    port 53 { any; };
listen-on-v6 port 53 { any; };
allow-query          { any; };
---

vim /etc/named.rfc1912.zones

---
zone "acgist.com" IN {
        type master;
        file "/etc/acgist.com.zone";
};
---

vim /etc/acgist.com.zone

---
; @ = 本域
$TTL 1D  
@       IN SOA @ acgist.com. (0 1H 10M 1D 3H)
        IN NS  @                ; @
        IN A   127.0.0.1        ; www
test    IN A   10.0.0.1         ; 子域
demo    IN A   10.255.163.252   ; 子域
---

chown named:named /etc/acgist.com.zone

systemctl restart named
systemctl enable  named

nslookup acgist.com      127.0.0.1
nslookup test.acgist.com 127.0.0.1
nslookup demo.acgist.com 127.0.0.1