我最近在 CentOS 機器上安裝了 Bind。一切似乎都在僅打開連接埠 53 的情況下運作。但是,我注意到在設定檔中 rndc.conf 中有一行內容為“default-port 953;”我沒有打開連接埠 953,並且 Bind 似乎正在工作。我可以讓 953 保持關閉嗎? RNDC 監聽 953 有什麼意義?
答案1
這列印什麼?
$ sudo netstat -ntlp | grep ':953\>'
它應該會列印如下內容:
tcp 0 0 127.0.0.1:953 0.0.0.0:* LISTEN 1234/named
或者如果您啟用了 IPv6:
tcp 0 0 127.0.0.1:953 0.0.0.0:* LISTEN 1234/named
tcp 0 0 ::1:953 :::* LISTEN 1234/named
由於它僅使用環回位址,因此該連接埠只能由登入伺服器本身的使用者訪問,而不能從網路上的其他位置存取。
rndc 用於管理名稱伺服器,例如“rndc reload”是告訴 BIND 您更改了區域檔案並且應該重新載入它們的首選方式。
在我的 Debian 伺服器上(不確定 CentOS),/etc/init.d/bind9 也需要它來啟動和停止服務。我認為 CentOS 將該檔案稱為 /etc/init.d/named。如果不先檢查該腳本如何運作,我不會停用它或阻止它。
您可以執行的命令的完整清單位於BIND 9 管理員參考手冊 - 管理工具。
至於為什麼使用TCP端口,可以運行“man rndc”查看詳情:
rndc communicates with the name server over a TCP connection, sending
commands authenticated with digital signatures. In the current versions
of rndc and named, the only supported authentication algorithm is
HMAC-MD5, which uses a shared secret on each end of the connection.
This provides TSIG-style authentication for the command request and the
name server’s response. All commands sent over the channel must be
signed by a key_id known to the server.
rndc reads a configuration file to determine how to contact the name
server and decide what algorithm and key it should use.
因此,如果您想保護它,請查看密鑰和密鑰檔案的詳細資訊。例如,/etc/bind/rndc.key(或/etc/named/rndc.key)應具有受限權限。
答案2
RNDC 是遠端管理連接埠。不要向外界開放。除非您使用 rndc 實用程序,否則根本不需要打開此端口,您可以安全地將其關閉。
Bind 需要 UDP 53 來服務正常請求。如果(且僅當)該伺服器是某個區域的主伺服器且輔助伺服器需要從該伺服器進行傳輸時,您也應該開啟 TCP 53。
答案3
在 /etc/named.conf 末尾添加以下內容(RedHat 相容,Debian??)
控制{};
禁用它。我認為在從屬 DNS 伺服器上開啟它沒有任何意義。
答案4
實際上,BIND 監聽的是環回介面的 TCP 連接埠 953。 RNDC 是一個可用來控制 BIND 的客戶端公用程式。 RNDC 透過 TCP 連接埠 953 與 BIND 對話。