Bind9 启动但不会监听任何端口

Bind9 启动但不会监听任何端口

我现在快要疯了……

我全新安装了 Ubuntu 20.04.6,并尝试让 bind9 工作。但我没有成功。

我首先删除了 systemd-resolved,然后直接将 ipv4 DNS 添加到 resolv.conf。

安装一些需要的东西并bind9。

问题是 bind9 作为服务启动 (systemctrl start|enable bind9),但未绑定到任何端口。我没有在 DNS 端口上运行任何其他程序。配置文件中没有问题,使用 named-checkconfig 验证,服务启动 - 但没有开放端口...

如果有人有时间的话,我真的需要一些帮助!

root@ns3:~# systemctl status bind9
● bind9.service - LSB: Start and stop bind9
     Loaded: loaded (/etc/init.d/bind9; generated)
     Active: active (exited) since Wed 2024-01-31 22:06:22 UTC; 7s ago
       Docs: man:systemd-sysv-generator(8)
    Process: 611 ExecStart=/etc/init.d/bind9 start (code=exited, status=0/SUCCESS)

Jan 31 22:04:11 ns3.*xxx*.net systemd[1]: Stopping LSB: Start and stop bind9...
Jan 31 22:04:12 ns3.*xxx*.net systemd[1]: bind9.service: Succeeded.
Jan 31 22:04:12 ns3.*xxx*.net systemd[1]: Stopped LSB: Start and stop bind9.
Jan 31 22:06:22 ns3.*xxx*.net systemd[1]: Starting LSB: Start and stop bind9...
Jan 31 22:06:22 ns3.*xxx*.net systemd[1]: Started LSB: Start and stop bind9.
root@ns3:~# ss -natulp
Netid     State       Recv-Q      Send-Q           Local Address:Port           Peer Address:Port     Process                               
udp       UNCONN      0           0                      0.0.0.0:1194                0.0.0.0:*         users:(("openvpn",pid=281,fd=4))     
tcp       LISTEN      0           128                    0.0.0.0:22                  0.0.0.0:*         users:(("sshd",pid=542,fd=3))        
tcp       LISTEN      0           20                   127.0.0.1:25                  0.0.0.0:*         users:(("exim4",pid=536,fd=3))       
tcp       LISTEN      0           128                       [::]:22                     [::]:*         users:(("sshd",pid=542,fd=4))        
tcp       LISTEN      0           20                       [::1]:25                     [::]:*         users:(("exim4",pid=536,fd=4))
root@ns3:~# cat /etc/bind/named.conf
include "/etc/bind/named.conf.options";
include "/etc/bind/named.conf.default-zones";
include "/etc/bind/named.conf.local";

root@ns3:~# cat /etc/bind/named.conf.options 
options {
    directory "/var/cache/bind";
    dnssec-validation auto;
    listen-on-v6 { none; };
    listen-on port 53 { 0.0.0.0/0; };
    auth-nxdomain yes;
    allow-query { any; };
    allow-transfer { aa.bb.cc.dd; aa.bb.cc.ee; };
};

root@ns3:~# cat /etc/bind/named.conf.local
zone "*xxx*.net" {
        type master;
        file "/etc/bind/master/*xxx*.net";
};
Thanks a lot for answering, but I'm afraid the logs are not very enlightening...

Jan 31 21:50:12 ns3.xxx.net systemd[1]: Stopping LSB: Start and stop bind9... Jan 31 21:50:12 ns3.xxx.net systemd[1]: bind9.service: Succeeded. Jan 31 21:50:12 ns3.xxx.net systemd[1]: Stopped LSB: Start and stop bind9. Jan 31 21:50:12 ns3.xxx.net systemd[1]: Starting LSB: Start and stop bind9... Jan 31 21:50:12 ns3.xxx.net systemd[1]: Started LSB: Start and stop bind9. Jan 31 21:50:53 ns3.xxx.net systemd[1]: Stopping LSB: Start and stop bind9... Jan 31 21:50:53 ns3.xxx.net systemd[1]: bind9.service: Succeeded. Jan 31 21:50:53 ns3.xxx.net systemd[1]: Stopped LSB: Start and stop bind9. Jan 31 21:50:53 ns3.xxx.net systemd[1]: Starting LSB: Start and stop bind9... Jan 31 21:50:53 ns3.xxx.net systemd[1]: Started LSB: Start and stop bind9. Jan 31 21:51:20 ns3.xxx.net systemd[1]: Stopping LSB: Start and stop bind9... Jan 31 21:51:20 ns3.xxx.net systemd[1]: bind9.service: Succeeded. Jan 31 21:51:20 ns3.xxx.net systemd[1]: Stopped LSB: Start and stop bind9. Jan 31 21:51:20 ns3.xxx.net systemd[1]: Starting LSB: Start and stop bind9... Jan 31 21:51:20 ns3.xxx.net systemd[1]: Started LSB: Start and stop bind9. Jan 31 22:04:11 ns3.xxx.net systemd[1]: Stopping LSB: Start and stop bind9... Jan 31 22:04:12 ns3.xxx.net systemd[1]: bind9.service: Succeeded. Jan 31 22:04:12 ns3.xxx.net systemd[1]: Stopped LSB: Start and stop bind9. Jan 31 22:04:25 ns3.xxx.net systemd[1]: Starting LSB: Start and stop bind9... Jan 31 22:04:25 ns3.xxx.net systemd[1]: Started LSB: Start and stop bind9. Jan 31 22:06:22 ns3.xxx.net systemd[1]: Stopping LSB: Start and stop bind9... Jan 31 22:06:22 ns3.xxx.net systemd[1]: bind9.service: Succeeded. Jan 31 22:06:22 ns3.xxx.net systemd[1]: Stopped LSB: Start and stop bind9. Jan 31 22:06:22 ns3.xxx.net systemd[1]: Starting LSB: Start and stop bind9... Jan 31 22:06:22 ns3.xxx.net systemd[1]: Started LSB: Start and stop bind9.
and from syslog: Jan 31 21:50:12 ns3 systemd[1]: Stopping LSB: Start and stop bind9... Jan 31 21:50:12 ns3 systemd[1]: bind9.service: Succeeded. Jan 31 21:50:12 ns3 systemd[1]: Stopped LSB: Start and stop bind9. Jan 31 21:50:12 ns3 systemd[1]: Starting LSB: Start and stop bind9... Jan 31 21:50:12 ns3 systemd[1]: Started LSB: Start and stop bind9. Jan 31 21:50:53 ns3 systemd[1]: Stopping LSB: Start and stop bind9... Jan 31 21:50:53 ns3 systemd[1]: bind9.service: Succeeded. Jan 31 21:50:53 ns3 systemd[1]: Stopped LSB: Start and stop bind9. Jan 31 21:50:53 ns3 systemd[1]: Starting LSB: Start and stop bind9... Jan 31 21:50:53 ns3 systemd[1]: Started LSB: Start and stop bind9. Jan 31 21:51:20 ns3 systemd[1]: Stopping LSB: Start and stop bind9... Jan 31 21:51:20 ns3 systemd[1]: bind9.service: Succeeded. Jan 31 21:51:20 ns3 systemd[1]: Stopped LSB: Start and stop bind9. Jan 31 21:51:20 ns3 systemd[1]: Starting LSB: Start and stop bind9... Jan 31 21:51:20 ns3 systemd[1]: Started LSB: Start and stop bind9. Jan 31 22:04:11 ns3 systemd[1]: Stopping LSB: Start and stop bind9... Jan 31 22:04:25 ns3 systemd[1]: Starting LSB: Start and stop bind9... Jan 31 22:04:25 ns3 systemd[1]: Started LSB: Start and stop bind9. Jan 31 22:06:22 ns3 systemd[1]: Stopping LSB: Start and stop bind9... Jan 31 22:06:22 ns3 systemd[1]: bind9.service: Succeeded. Jan 31 22:06:22 ns3 systemd[1]: Stopped LSB: Start and stop bind9. Jan 31 22:06:22 ns3 systemd[1]: Starting LSB: Start and stop bind9... Jan 31 22:06:22 ns3 systemd[1]: Started LSB: Start and stop bind9.

非常感谢您的回答,但恐怕这些日志没有什么启发性......

Jan 31 21:50:12 ns3.xxx.net systemd[1]: Stopping LSB: Start and stop bind9...
Jan 31 21:50:12 ns3.xxx.net systemd[1]: bind9.service: Succeeded.
Jan 31 21:50:12 ns3.xxx.net systemd[1]: Stopped LSB: Start and stop bind9.
Jan 31 21:50:12 ns3.xxx.net systemd[1]: Starting LSB: Start and stop bind9...
Jan 31 21:50:12 ns3.xxx.net systemd[1]: Started LSB: Start and stop bind9.
Jan 31 21:50:53 ns3.xxx.net systemd[1]: Stopping LSB: Start and stop bind9...
Jan 31 21:50:53 ns3.xxx.net systemd[1]: bind9.service: Succeeded.
Jan 31 21:50:53 ns3.xxx.net systemd[1]: Stopped LSB: Start and stop bind9.
Jan 31 21:50:53 ns3.xxx.net systemd[1]: Starting LSB: Start and stop bind9...
Jan 31 21:50:53 ns3.xxx.net systemd[1]: Started LSB: Start and stop bind9.
Jan 31 21:51:20 ns3.xxx.net systemd[1]: Stopping LSB: Start and stop bind9...
Jan 31 21:51:20 ns3.xxx.net systemd[1]: bind9.service: Succeeded.
Jan 31 21:51:20 ns3.xxx.net systemd[1]: Stopped LSB: Start and stop bind9.
Jan 31 21:51:20 ns3.xxx.net systemd[1]: Starting LSB: Start and stop bind9...
Jan 31 21:51:20 ns3.xxx.net systemd[1]: Started LSB: Start and stop bind9.
Jan 31 22:04:11 ns3.xxx.net systemd[1]: Stopping LSB: Start and stop bind9...
Jan 31 22:04:12 ns3.xxx.net systemd[1]: bind9.service: Succeeded.
Jan 31 22:04:12 ns3.xxx.net systemd[1]: Stopped LSB: Start and stop bind9.
Jan 31 22:04:25 ns3.xxx.net systemd[1]: Starting LSB: Start and stop bind9...
Jan 31 22:04:25 ns3.xxx.net systemd[1]: Started LSB: Start and stop bind9.
Jan 31 22:06:22 ns3.xxx.net systemd[1]: Stopping LSB: Start and stop bind9...
Jan 31 22:06:22 ns3.xxx.net systemd[1]: bind9.service: Succeeded.
Jan 31 22:06:22 ns3.xxx.net systemd[1]: Stopped LSB: Start and stop bind9.
Jan 31 22:06:22 ns3.xxx.net systemd[1]: Starting LSB: Start and stop bind9...
Jan 31 22:06:22 ns3.xxx.net systemd[1]: Started LSB: Start and stop bind9.

来自系统日志:

Jan 31 21:50:12 ns3 systemd[1]: Stopping LSB: Start and stop bind9...
Jan 31 21:50:12 ns3 systemd[1]: bind9.service: Succeeded.
Jan 31 21:50:12 ns3 systemd[1]: Stopped LSB: Start and stop bind9.
Jan 31 21:50:12 ns3 systemd[1]: Starting LSB: Start and stop bind9...
Jan 31 21:50:12 ns3 systemd[1]: Started LSB: Start and stop bind9.
Jan 31 21:50:53 ns3 systemd[1]: Stopping LSB: Start and stop bind9...
Jan 31 21:50:53 ns3 systemd[1]: bind9.service: Succeeded.
Jan 31 21:50:53 ns3 systemd[1]: Stopped LSB: Start and stop bind9.
Jan 31 21:50:53 ns3 systemd[1]: Starting LSB: Start and stop bind9...
Jan 31 21:50:53 ns3 systemd[1]: Started LSB: Start and stop bind9.
Jan 31 21:51:20 ns3 systemd[1]: Stopping LSB: Start and stop bind9...
Jan 31 21:51:20 ns3 systemd[1]: bind9.service: Succeeded.
Jan 31 21:51:20 ns3 systemd[1]: Stopped LSB: Start and stop bind9.
Jan 31 21:51:20 ns3 systemd[1]: Starting LSB: Start and stop bind9...
Jan 31 21:51:20 ns3 systemd[1]: Started LSB: Start and stop bind9.
Jan 31 22:04:11 ns3 systemd[1]: Stopping LSB: Start and stop bind9...
Jan 31 22:04:25 ns3 systemd[1]: Starting LSB: Start and stop bind9...
Jan 31 22:04:25 ns3 systemd[1]: Started LSB: Start and stop bind9.
Jan 31 22:06:22 ns3 systemd[1]: Stopping LSB: Start and stop bind9...
Jan 31 22:06:22 ns3 systemd[1]: bind9.service: Succeeded.
Jan 31 22:06:22 ns3 systemd[1]: Stopped LSB: Start and stop bind9.
Jan 31 22:06:22 ns3 systemd[1]: Starting LSB: Start and stop bind9...
Jan 31 22:06:22 ns3 systemd[1]: Started LSB: Start and stop bind9.

编辑 我想我找到了 - bind9 不是本机服务,但 named 是。这意味着“systemctl enable bind9”不起作用。我改为启用了 named,它在 /etc/systemd/system/ 中创建了一个名为 bind9.service 的符号链接(bind9.service -> /lib/systemd/system/named.service)

以前我没有遇到过这个问题,但不知什么原因,这次却变成了这样。

抱歉打扰你们了!


另一件可能有趣的事情是,这是一个 VPS 安装。我有另一个 VPS,它使用了同样的 Ubuntu,而且运行完美。

相关内容