我在Virtual Box上安装了archlinux,并使用NetworkManager处理连接。 在尝试从使用NetworkManager进行dns切换到“未绑定”后,我似乎没有让它们一起运行。我遵循https://wiki.archlinux.org/index.php/unbound
上的取消绑定指南我的/etc/unbound/unbound.conf看起来像:
include: "/etc/unbound/resolvconf.conf"
server:
use-syslog: yes
do-daemonize: no
username: "unbound"
directory: "/etc/unbound"
trust-anchor-file: trusted-key.key
private-domain: "intranet"
private-domain: "internal"
private-domain: "private"
private-domain: "corp"
private-domain: "home"
private-domain: "lan"
unblock-lan-zones: yes
insecure-lan-zones: yes
domain-insecure: "intranet"
domain-insecure: "internal"
domain-insecure: "private"
domain-insecure: "corp"
domain-insecure: "home"
domain-insecure: "lan"
root-hints: root.hints
我的/etc/resolvconf.conf看起来像:
# Configuration for resolvconf(8)
# See resolvconf.conf(5) for details
resolv_conf=/etc/resolv.conf:
# If you run a local name server, you should uncomment the below line and
# configure your subscribers configuration files below.
name_servers="::1 127.0.0.1"
private_interfaces="*"
# Write out unbound configuration file
unbound_conf=/etc/unbound/resolvconf.conf
在使用resolvconf -u生成新的resolv.conf之后,/ etc / resolv.conf如下所示:
# Generated by resolvconf
nameserver ::1
nameserver 127.0.0.1
在检查了systemctl status unbound之后,它说unbound是活动的并且正在运行。 重新引导后,NetworkManager仍会生成resolv.conf并从resolvconf -u命令中将其重置。因此,经过一番搜索之后,我发现我应该从一开始就在/etc/NetworkManager/NetworkManager.conf中设置dns = unbound,而只需要在顶部注释掉行,并添加了[main]和dns = unbound字段:
# Configuration file for NetworkManager.
# See "man 5 NetworkManager.conf" for details.
[main]
dns=unbound
现在,重启后/etc/resolv.conf不会被networkmanager重置,但是我没有任何互联网连接,并且systemctl状态为NetworkManager 说它无法启动:
NetworkManager.service: Main process exited, code=exited, status=1/FAILURE
NetworkManager.service: Failed with result 'exit-code'.
Failed to start Network Manager.
NetworkManager.service: Service RestartSec=100ms expired, scheduling restart.
我真的不明白问题出在哪里,从我的理解来看,使用NetworkManager将'unbound'作为dns应该相当简单。
答案 0 :(得分:-1)
我似乎通过不将networkmanager.conf设置为
解决了这个问题[main]
dns=unbound
但将其设置为:
[main]
dns=none
现在,重新启动后,resolv.conf不会被networkmanager重置,我也可以连接互联网。