所以我对此很陌生,并且一直在关注本教程设置绑定,到 4:50 为止,我没有遇到任何问题,我可以 ping 通,使用 nslookup 并与 dns 服务器建立互联网连接,然后我们必须添加区域并创建区域文件(只需创建它们),完美,我重新启动以查看是否有任何问题(顺便说一下,我使用的是虚拟机),然后我无法再 ping 通,无法使用 nslookup,我甚至没有互联网连接。这是我使用 systemctl status 得到的结果
Redirecting to /bin/systemctl status -l named.service
● named.service - Berkeley Internet Name Domain (DNS)
Loaded: loaded (/usr/lib/systemd/system/named.service; enabled; vendor prese$
Active: failed (Result: exit-code) since jue 2019-04-25 23:14:30 -04; 3min 3$
Process: 3355 ExecStartPre=/bin/bash -c if [ ! "$DISABLE_ZONE_CHECKING" == "y$
abr 25 23:14:30 linux bash[3355]: _default/0.168.192.in-addr.arpa/IN: bad zone
abr 25 23:14:30 linux bash[3355]: zone localhost.localdomain/IN: loaded serial 0
abr 25 23:14:30 linux bash[3355]: zone localhost/IN: loaded serial 0
abr 25 23:14:30 linux bash[3355]: zone
1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.$
abr 25 23:14:30 linux bash[3355]: zone 1.0.0.127.in-addr.arpa/IN: loaded serial$
abr 25 23:14:30 linux bash[3355]: zone 0.in-addr.arpa/IN: loaded serial 0
abr 25 23:14:30 linux systemd[1]: named.service: control process exited, code=e$
abr 25 23:14:30 linux systemd[1]: Failed to start Berkeley Internet Name Domain$
abr 25 23:14:30 linux systemd[1]: Unit named.service entered failed state.
abr 25 23:14:30 linux systemd[1]: named.service failed.
我认为这是由于区域文件为空,所以我从 named.conf 中删除了区域,尝试使用服务重启命名重新启动,但再次出现以下情况:
Failed to start BIND : Redirecting to /bin/systemctl start named.service Job
for named.service failed because the control process exited with error code.
See "systemctl status named.service" and "journalctl -xe" for details.
所以我做了
● named.service - Berkeley Internet Name Domain (DNS)
Loaded: loaded (/usr/lib/systemd/system/named.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since jue 2019-04-25 23:25:30 -04; 1min 3s ago
Process: 5557 ExecStart=/usr/sbin/named -u named -c ${NAMEDCONF} $OPTIONS (code=exited, status=1/FAILURE)
Process: 5552 ExecStartPre=/bin/bash -c if [ ! "$DISABLE_ZONE_CHECKING" == "yes" ]; then /usr/sbin/named-checkconf -z "$NAMEDCONF"; else echo "Checking of zone files is disabled"; fi (code=exited, status=0/SUCCESS)
abr 25 23:25:30 linux named[5559]: found 2 CPUs, using 2 worker threads
abr 25 23:25:30 linux named[5559]: using 2 UDP listeners per interface
abr 25 23:25:30 linux named[5559]: using up to 21000 sockets
abr 25 23:25:30 linux named[5559]: loading configuration from '/etc/named.conf'
abr 25 23:25:30 linux named[5559]: open: /etc/named.conf: permission denied
abr 25 23:25:30 linux named[5559]: loading configuration: permission denied
abr 25 23:25:30 linux systemd[1]: named.service: control process exited, code=exited status=1
abr 25 23:25:30 linux systemd[1]: Failed to start Berkeley Internet Name Domain (DNS).
abr 25 23:25:30 linux systemd[1]: Unit named.service entered failed state.
abr 25 23:25:30 linux systemd[1]: named.service failed.
这是一个权限问题,但之前它运行得很好,所以我很茫然。
这是我执行 ls -l /etc/named.conf 得到的结果:
-rw-r-----. 1 root root 1808 abr 25 15:13 /etc/named.conf
不确定是否有帮助,但这是 named.conf
options {
listen-on port 53 { 127.0.0.1; };
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-query { localhost; };
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";
};
include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";
有解决办法吗?谢谢。
答案1
您可能遇到了 selinux 问题:使用 检查文件ls -Z
。
其他选项:如果您安装了 chroot,那么所有文件都与/var/named/chroot
.
答案2
当我替换named.conf时,selinux上下文变得混乱,当执行ls -Z时它应该看起来像这样
-rw-r--r--. root root system_u:object_r:named_conf_t:s0 named.conf
正如你所看到的,我的有所不同,为了重置它,我使用了
restorecon -RFv /etc/named.conf
但是,执行 ls -Z 时,我得到了这个
-rw-r-----. root root system_u:object_r:named_conf_t:s0 named.conf
为了添加最后一个“r”,以便每个人都能读到它,我做了
chmod 644 /etc/named.conf
停止该服务并重新启动它,它又可以正常工作。