Debian

未綁定不啟動

  • November 18, 2021

安裝 Unbound 後

apt-get -y install unbound dnsutils

su -c "unbound-anchor -a /var/lib/unbound/root.key" - unbound
systemctl reload unbound

apt-get -y install resolvconf
echo "nameserver 127.0.0.1" >> /etc/resolvconf/resolv.conf.d/head

我無法正確啟動它:

root@xyz:~/asdf# service unbound status
● unbound.service - Unbound DNS server
  Loaded: loaded (/lib/systemd/system/unbound.service; enabled; vendor preset: enabled)
  Active: activating (auto-restart) (Result: exit-code) since Fri 2017-12-29 13:59:49 CET; 81ms ago
    Docs: man:unbound(8)
 Process: 1676 ExecStart=/usr/sbin/unbound -d $DAEMON_OPTS (code=exited, status=1/FAILURE)
 Process: 1670 ExecStartPre=/usr/lib/unbound/package-helper root_trust_anchor_update (code=exited, status=0/SUCCESS)
 Process: 1665 ExecStartPre=/usr/lib/unbound/package-helper chroot_setup (code=exited, status=0/SUCCESS)
Main PID: 1676 (code=exited, status=1/FAILURE)

Dec 29 13:59:49 mail systemd[1]: unbound.service: Main process exited, code=exited, status=1/FAILURE
Dec 29 13:59:49 mail systemd[1]: unbound.service: Unit entered failed state.
Dec 29 13:59:49 mail systemd[1]: unbound.service: Failed with result 'exit-code'.

主機文件內容:

127.0.0.1   localhost
127.0.1.1   mail.xyz.de  mail

::1         localhost ip6-localhost ip6-loopback
ff02::1     ip6-allnodes
ff02::2     ip6-allrouters

我真的對那個錯誤感到困惑。

編輯: journalctl -xe 輸出(縮短):

Dec 29 16:01:04 mail systemd[1]: unbound-resolvconf.service: Unit entered failed state.
Dec 29 16:01:04 mail systemd[1]: unbound-resolvconf.service: Failed with result 'start-limit-hit'.
Dec 29 16:01:04 mail unbound[59226]: [1514559664] unbound[59226:0] error: can't bind socket: Cannot assign requested address for ::1
Dec 29 16:01:04 mail unbound[59226]: [1514559664] unbound[59226:0] fatal error: could not open ports
Dec 29 16:01:04 mail systemd[1]: unbound.service: Main process exited, code=exited, status=1/FAILURE
Dec 29 16:01:04 mail systemd[1]: unbound.service: Unit entered failed state.
Dec 29 16:01:04 mail systemd[1]: unbound.service: Failed with result 'exit-code'.
Dec 29 16:01:04 mail systemd[1]: unbound-resolvconf.service: Start request repeated too quickly.
Dec 29 16:01:04 mail systemd[1]: Failed to start Unbound DNS server via resolvconf.
-- Subject: Unit unbound-resolvconf.service has failed

編輯 2:系統上也安裝了 Arno Ip 表!

編輯 3:禁用 IPv6,如果這與錯誤有關。

net.ipv6.conf.all.disable_ipv6 = 1 net.ipv6.conf.default.disable_ipv6 = 1 net.ipv6.conf.lo.disable_ipv6 = 1 net.ipv6.conf.ens3.disable_ipv6 = 1

編輯 4:這是我通過 apt-get 安裝後的 /etc/unbound/unbound.conf

# Unbound configuration file for Debian.
#
# See the unbound.conf(5) man page.
#
# See /usr/share/doc/unbound/examples/unbound.conf for a commented
# reference config file.
#
# The following line includes additional configuration files from the
# /etc/unbound/unbound.conf.d directory.
include: "/etc/unbound/unbound.conf.d/*.conf"

我將其更改為:

server:
       interface: 127.0.0.1

include: "/etc/unbound/unbound.conf.d/*.conf"

但它也不起作用:/

錯誤消息顯示禁用 IPv6 導致了該問題。

Dec 29 16:01:04 mail unbound[59226]: [1514559664] unbound[59226:0] error: can't bind socket: Cannot assign requested address for ::1
Dec 29 16:01:04 mail unbound[59226]: [1514559664] unbound[59226:0] fatal error: could not open ports

IPv6 真的不再是可選的了。已經有一段時間沒有了。當然,最好的辦法是不要在系統上禁用 IPv6。

如果由於某種原因您不能這樣做,請檢查您的unbound.confinterfacecontrol-interface指定 IPv6 地址的指令並刪除它們。請注意,預設值control-interface是監聽 127.0.0.1 和 ::1,因此如果您不想要 ::1,則必須明確指定它。

引用自:https://serverfault.com/questions/889996