如何在 Linux 中使用 resolvectl 设置 DNS 服务器
现代 Linux 发行版使用 systemd-resolved 管理 DNS 设置。你可以使用 resolvectl 管理这些设置:
你需要知道主网络接口的名称。使用 ifconfig 查找它。
在此示例中,我们使用 enp3s0 作为网络接口名称。
此命令将你的主 DNS 服务器设置为 Cloudflare DNS 服务器(1.1.1.1):
resolvectl_set_dns.sh
sudo resolvectl dns enp3s0 1.1.1.1Check out similar posts by category:
Linux
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow