我有一台 DNS 主服务器 (192.168.102.159) 和一台从服务器 (192.168.102.132),两台服务器都是虚拟机,主服务器配置正常,可以进行正向和反向查找,但是,当我尝试使用从服务器进行区域传输时,从服务器会抛出以下错误:连接失败:主机无法访问,我已检查 conf 和区域文件中的 IP 地址是否正确,区域文件在 named-checkzone 中也没有显示任何错误。这是我的第二次设置,在之前的设置中,我收到错误 rndc.key not found,然后是此错误,但是,在此设置中,我只收到此错误。
我已经在 Slave 中的从属文件夹上添加了 chgrp 和 chown,但是,没有添加防火墙条目,不确定是否必须这样做。
防火墙条目
iptables -A INPUT -i ens33 -p tcp -m state --state NEW,ESTABLISHED -s 192.168.102.132 --sport 1024:65535 --dport 53 -j ACCEPT
iptables -A INPUT -i ens33 -p udp -m state --state NEW,ESTABLISHED -s 192.168.102.132 --sport 1024:65535 --dport 53 -j ACCEPT
named.conf (主)
acl internals { 192.168.102.0/24; };
options {
listen-on port 53 { 127.0.0.1; 192.168.102.159; };
listen-on-v6 port 53 { ::1; };
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";
recursing-file "/var/named/data/named.recursing";
secroots-file "/var/named/data/named.secroots";
allow-transfer { 192.168.102.132; };
allow-query { localhost; internals; };
recursion yes;
/*
dnssec-enable yes;
dnssec-validation yes;
*/
/* Path to ISC DLV key */
bindkeys-file "/etc/named.iscdlv.key";
managed-keys-directory "/var/named/dynamic";
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";
};
zone "abc.local" { type master; file "abc.db"; allow-transfer { 192.168.102.132; }; };
zone "102.168.192.IN-ADDR.ARPA" { type master; file "cba.db"; allow-transfer { 192.168.102.132; }; };
include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";
named.conf (从属)
acl internals { 192.168.102.0/24; };
options {
listen-on port 53 { 127.0.0.1; 192.168.102.132; };
listen-on-v6 port 53 { ::1; };
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";
recursing-file "/var/named/data/named.recursing";
secroots-file "/var/named/data/named.secroots";
allow-notify { 192.168.102.159; };
allow-query { localhost; internals; };
recursion yes;
dnssec-enable yes;
dnssec-validation yes;
/* Path to ISC DLV key */
bindkeys-file "/etc/named.iscdlv.key";
managed-keys-directory "/var/named/dynamic";
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";
};
zone "abc.local" { type slave; masters { 192.168.102.159; }; file "slaves/abc.db"; allow-transfer { 192.168.102.159; }; };
zone "102.168.192.IN-ADDR.ARPA" { type slave; masters { 192.168.102.159; }; file "slaves/cba.db"; allow-transfer { 192.168.102.159; }; };
include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";
ABC数据库
$TTL 3H
$ORIGIN abc.local.
@ IN SOA ns1.abc.local. ns2.abc.local. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
IN NS ns1.abc.local.
IN NS ns2.abc.local.
ns1 IN A 192.168.102.159
ns2 IN A 192.168.102.132
联赛数据库
$TTL 3H
$ORIGIN 102.168.192.IN-ADDR.ARPA.
@ IN SOA ns1.abc.local. ns2.abc.local. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
IN NS ns1.abc.local.
IN NS ns2.abc.local.
159 IN PTR ns1.abc.local.
132 IN PTR ns2.abc.local.
错误
30-Dec-2018 20:33:24.030 managed-keys-zone: journal file is out of date: removin g journal file
30-Dec-2018 20:33:24.030 managed-keys-zone: loaded serial 2
30-Dec-2018 20:33:24.031 zone 0.in-addr.arpa/IN: loaded serial 0
30-Dec-2018 20:33:24.033 zone 1.0.0.127.in-addr.arpa/IN: loaded serial 0
30-Dec-2018 20:33:24.035 zone localhost.localdomain/IN: loaded serial 0
30-Dec-2018 20:33:24.035 zone localhost/IN: loaded serial 0
30-Dec-2018 20:33:24.037 zone 1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0. 0.0.0.0.0.0.0.ip6.arpa/IN: loaded serial 0
30-Dec-2018 20:33:24.037 all zones loaded
30-Dec-2018 20:33:24.037 running
30-Dec-2018 20:34:54.045 zone abc.local/IN: refresh: retry limit for master 192.168.102.159#53 exceeded (source 0.0.0.0#0)
30-Dec-2018 20:34:54.045 zone abc.local/IN: Transfer started.
30-Dec-2018 20:34:54.046 transfer of 'abc.local/IN' from 192.168.102.159#53: failed to connect: host unreachable
30-Dec-2018 20:34:54.046 transfer of 'abc.local/IN' from 192.168.102.159#53: Transfer completed: 0 messages, 0 records, 0 bytes, 0.001 secs (0 bytes/sec)
30-Dec-2018 20:34:54.547 zone 102.168.192.IN-ADDR.ARPA/IN: refresh: retry limit for master 192.168.102.159#53 exceeded (source 0.0.0.0#0)
主从双方都可以互相ping通。