-1

我在 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 status 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 的 dns 应该是相当直接的。

4

1 回答 1

0

我似乎通过不将 networkmanager.conf 设置为来解决了这个问题

[main]
dns=unbound

而是将其设置为:

[main]
dns=none

现在重启后resolv.conf不会被networkmanager重置,我也有互联网连接。

于 2019-02-03T14:46:03.423 回答