设置新的 DNS 服务器

设置新的 DNS 服务器

我最近升级到了 Lubuntu 17.10.1。在设置 VPN 时,我转到 /etc/resolv.conf 来设置我的 DNS 服务器(以防止 DNS 泄漏)。但是,现在显示为:

 This file is managed by man:systemd-resolved(8). Do not edit.
#
# This is a dynamic resolv.conf file for connecting local clients directly to
# all known DNS servers.
#
# Third party programs must not access this file directly, but only through the
# symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a different way,
# replace this symlink by a static file or a different symlink.
#
# See man:systemd-resolved.service(8) for details about the supported modes of
# operation for /etc/resolv.conf.

我忽略了第一句话,还是编辑了文件。但没有任何效果。终端仍然输出默认服务器,泄漏测试网站仍然显示我的本地 ISP。我已经疯狂了两天,试图让系统接受我选择的服务器,但似乎什么都不起作用,我一直在搜索互联网,尝试所有我能找到的方法,包括这个:如何修复 DNS 泄漏? 有人有万无一失的方法吗?

答案1

尝试删除符号链接并用注释中所述的新原始静态文件替换 resolv.conf。

#
# Third party programs must not access this file directly, but only through the
# symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a different way,
# replace this symlink by a static file or a different symlink.
#

如果您的 VPS 使用 DHCP 加载初始网络配置,dhclient 可以覆盖 resolve.conf。如果是这种情况,您可以更新该/etc/dhcp/dhclient.conf文件以取代domain-name domain-searchdomain-name-servers文件。像这样

supersede domain-name "mydomain.com";
supersede domain-search "mydomain.com";
supersede domain-name-servers ip1 1p2 ip3;

相关内容