DNS服务器systemctl start named启动失败

systemctl restart  named

Job for named.service failed because the control process exited with error code. See "systemctl status named.service" and "journalctl -xe" for details.

命令:named-checkconf -z /etc/named.conf
zone linuxprobe.com/IN: NS 'ns.linuxprobe.com.linuxprobe.com' has no address records (A or AAAA)
zone linuxprobe.com/IN: not loaded due to errors.  // 没有指定A记录导致出错

在 /usr/lib/systemd/system/named.service 中定义了一行:
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'

就是因为启动 named 前会检查 named-checkconf -z /etc/named.conf ,回应 exit 1,所以启动失败

解决方式

1. 直接用 named -u named 启动,如果要习惯 systemctl restart named.service启动的话,就不要这么做了,只是暂时。
2. 改写 ExecStartPre 检查方式,让它 exit 0
3.注解ExecStartPre 不检查 zone
4. 或在 /etc/sysconfig/named 加入 DISABLE_ZONE_CHECKING=”yes”,并确认 named.service 文档里的 EnvironmentFile 是不是长这样: EnvironmentFile=/etc/sysconfig/named,我刚看时是长这样: EnvironmentFile=-/etc/sysconfig/named (多了 – dash)。改了 named.service 后要 systemctl daemon-reload

 

你可能感兴趣的:(linux,DNS)