技术解析
有大大熟悉 DNS 的看到还麻烦解决下疑惑,花了一天排查都不知道问题出在哪里
环境:
CentOS 7
防火墙关闭,selinux 关闭
YUM 安装以下包
bind-libs-9.9.4-61.el7.x86_64
bind-9.9.4-61.el7.x86_64
bind-utils-9.9.4-61.el7.x86_64
/etc/named.conf 配置,改了个监听 IP,删除 dnssec 相关的行,其它基本没有改动
options {
listen-on port 53 { 192.168.4.95; };
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
memstatistics-file "/var/named/data/named_mem_stats.txt";
allow-query { any; };
recursion yes;
pid-file "/run/named/named.pid";
session-keyfile "/run/named/session.key";
};
logging {
channel default_debug {
file "data/named.run";
severity dynamic;
};
};
zone "." IN {
type hint;
file "named.ca";
};
include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";
zone "test" IN {
type master;
file "test.zone";
};
$TTL 100
@ IN SOA ns1.main.ccom. mail.main.ccom. (
2018062201
1H
5M
7D
100 )
IN NS ns1
IN MX 10 mx1
ns1 IN A 192.168.4.95
mx1 IN A 192.168.4.96
test IN A 172.16.4.4
www IN A 192.168.4.11
ftp IN CNAME www
systemctl start named.service # 启动正常
ss -tunlp | grep 53
udp UNCONN 0 0 192.168.4.95:53 *:* users:(("named",pid=1893,fd=512))
tcp LISTEN 0 10 192.168.4.95:53 *:* users:(("named",pid=1893,fd=21))
dig -t A ftp.main.ccom @192.168.4.95
; <<>> DiG 9.9.4-RedHat-9.9.4-61.el7 <<>> -t A ftp.main.ccom @192.168.4.95
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 46342
;; flags: qr rd ra ad; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;ftp.main.ccom. IN A
;; AUTHORITY SECTION:
. 9424 IN SOA a.root-servers.net. nstld.verisign-grs.com. 2018062500 1800 900 604800 86400
;; Query time: 0 msec
;; SERVER: 192.168.4.95#53(192.168.4.95)
;; WHEN: Mon Jun 25 03:59:40 EDT 2018
;; MSG SIZE rcvd: 117