Ubuntu 22.04.2 LTS 使用的 resolvconf 管理 dns
检查
systemctl status resolvconf
cat /etc/resolv.conf
临时修改,重启失效
vim /etc/resolv.conf
持久化修改
vim /etc/resolvconf/resolv.conf.d/head
点击查看代码
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
# 127.0.0.53 is the systemd-resolved stub resolver.
# run "systemd-resolve --status" to see details about the actual nameservers.
nameserver 114.114.114.114
resolvconf -u
/etc/resolvconf/resolv.conf.d/ 下几个文件的说明
目录中可能包含“base”、“head”、“original”和“tail”文件。所有文件均为 resolv.conf 格式。默认仅为 base 和 head。
base: 用于在无法找到其他数据时使用
head: 用于 resolv.conf 的头部,可以用于确保 DNS 服务器始终在列表中的第一个
original:仅仅是在安装 resolvconf 时备份的 resolv.conf 文件
tail: tail 中的任何条目都会附加到生成的 resolv.conf 的末尾。
参考
Make nameserver in /etc/resolv.conf persistent
标签:LTS,head,DNS,resolvconf,resolv,etc,tail,22.04,conf From: https://www.cnblogs.com/xaoc/p/18673916