bind搭建DNS

systemctl stop firewalld
systemctl disable firewalld
yum install bind*.x86_64 vim -yvim

systemctl enable named
systemctl start named
yum install -y net-tools
netstat -lntup | grep 53ide

vim /etc/named.conf
改爲listen-on port 53 { any; };
allow-query { any; };
而後在底部添加正向解析
zone 「test.com」 IN {
type master;
file 「test.com.zone」;
};測試

cd /var/named
cp named.localhost test.com.zone
vim test.com.zone
$TTL 1D
@ IN SOA ns.test.com. root.test.com. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS ns.test.com.
ns A 10.2.1.64
onlyoffice A 10.2.1.199rest

檢測配置文件是否報錯
named-checkconf /etc/named.conf
named-checkzone 「test.com.」 /var/named/test.com.zonecode

若是沒有報錯重啓named
systemc restart nameddns

測試解析域名:
dig ns.test.com @10.2.1.176cmd

[root@dns named]# dig ns.test.com @10.2.1.176域名

; <<>> DiG 9.9.4-RedHat-9.9.4-74.el7_6.1 <<>> ns.test.com @10.2.1.176
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 42212
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1it

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;ns.test.com. IN Aio

;; ANSWER SECTION:
ns.test.com. 86400 IN A 10.2.1.64

;; AUTHORITY SECTION:
test.com. 86400 IN NS ns.test.com.

;; Query time: 1 msec;; SERVER: 10.2.1.176#53(10.2.1.176);; WHEN: 四 7月 18 16:02:39 CST 2019;; MSG SIZE rcvd: 70

相關文章
相關標籤/搜索