绑定和开放端口

smu*_*che 5 bind centos

我最近在 CentOS 机器上安装了 Bind。一切似乎都在仅打开端口 53 的情况下运行。但是,我注意到在配置文件中 rndc.conf 中有一行内容为“default-port 953;” 我没有打开端口 953,并且 Bind 似乎正在工作。我可以让 953 保持关闭状态吗?RNDC 监听 953 有什么意义?

Mik*_*kel 6

这打印什么?

\n\n
$ sudo netstat -ntlp | grep \':953\\>\'\n
Run Code Online (Sandbox Code Playgroud)\n\n

它应该打印如下内容:

\n\n
tcp        0      0 127.0.0.1:953           0.0.0.0:*               LISTEN      1234/named\n
Run Code Online (Sandbox Code Playgroud)\n\n

或者如果您启用了 IPv6:

\n\n
tcp        0      0 127.0.0.1:953           0.0.0.0:*               LISTEN      1234/named\ntcp        0      0 ::1:953                 :::*                    LISTEN      1234/named\n
Run Code Online (Sandbox Code Playgroud)\n\n

由于它仅使用环回地址,因此该端口只能由登录到服务器本身的用户访问,而不能从网络上的其他位置访问。

\n\n

rndc 用于管理名称服务器,例如“rndc reload”是告诉 BIND 您更改了区域文件并且应该重新加载它们的首选方式。

\n\n

在我的 Debian 服务器上(不确定 CentOS),/etc/init.d/bind9 也需要它来启动和停止服务。我认为 CentOS 将该文件称为 /etc/init.d/named。如果不先检查该脚本如何工作,我不会禁用它或阻止它。

\n\n

您可以运行的命令的完整列表位于BIND 9 管理员参考手册 - 管理工具中。

\n\n

至于为什么使用TCP端口,可以运行“man rndc”查看详情:

\n\n
   rndc communicates with the name server over a TCP connection, sending\n   commands authenticated with digital signatures. In the current versions\n   of rndc and named, the only supported authentication algorithm is\n   HMAC-MD5, which uses a shared secret on each end of the connection.\n   This provides TSIG-style authentication for the command request and the\n   name server\xe2\x80\x99s response. All commands sent over the channel must be\n   signed by a key_id known to the server.\n\n   rndc reads a configuration file to determine how to contact the name\n   server and decide what algorithm and key it should use.\n
Run Code Online (Sandbox Code Playgroud)\n\n

因此,如果您想保护它,请查看密钥和密钥文件的详细信息。例如,/etc/bind/rndc.key(或/etc/named/rndc.key)应具有受限权限。

\n