linux - 未绑定(bind) DNS 的 NetworkManager

标签 linux dns archlinux networkmanager unbound

我在 Virtual Box 上安装了 archlinux,我使用 NetworkManager 来处理我的连接。 在我尝试从使用 NetworkManager for dns 切换为“未绑定(bind)”之后,我似乎无法让它们一起运行。我按照 https://wiki.archlinux.org/index.php/unbound 上的 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 命令重置该 resolv.conf。因此,经过一番搜索后,我发现我应该在/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 不会被网络管理器重置,但我没有任何互联网连接和 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.

我不太明白问题出在哪里,据我了解,使用“unbound”作为 NetworkManager 的 dns 应该相当简单。

最佳答案

我似乎通过不将 networkmanager.conf 设置为

解决了这个问题
[main]
dns=unbound

而是将其设置为:

[main]
dns=none

现在重新启动后,resolv.conf 不会被网络管理器重置,而且我也有互联网连接。

关于linux - 未绑定(bind) DNS 的 NetworkManager,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54503512/

相关文章:

c++ - 'directed to standard output (cout)' 是什么意思?

c - 在 C 中,如何在进行 execvp() 或类似调用时将 stdin/stdout/stderr 重定向到文件?

linux - Bash 脚本在终端仿真器中工作,但不能作为 i3 键绑定(bind)

wcf - WCF客户端端点:不带<dns>的SecurityNegotiationException

node.js - 如何在 localhost 上为通配符域创建一个 dns 服务器以与 node/express 一起使用?

ruby - 使用 ruby​​-install/ruby-build 在 Archlinux 上安装 Ruby 2.1.x 和 2.3.x 时出现 OpenSSL 错误

php - 使 App Engine for PHP 加载 BCMath 或 php.ini

linux - 关于iptables中 "-set-xmark"的一些问题

c - 如何在接收 GtkTreeModel 的函数中使用 GtkTreeStore

dns - 针对多个 ips 创建 _spf 记录