首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >每次覆盖resolv.conf

每次覆盖resolv.conf
EN

Unix & Linux用户
提问于 2018-11-23 08:21:22
回答 1查看 9.8K关注 0票数 0

我拿着这个

代码语言:javascript
复制
drwxrwxr-x 3 root tunnel 100 date and time .
drwxr-xr-x 33 root root 860 date and time …
-rwxrwxr-x 1 root tunnel 0 date and time enable-updates
drwxrwxr-x 2 root tunnel 40 date and time interface
-rwxrwxr-x 1 root tunnel 151 date and time resolv.conf

然后我跑了

代码语言:javascript
复制
sudo chown --recursive root:tunnel run/resolvconf
sudo chmod --recursive 775 /run/resolvconf

那我就明白了

代码语言:javascript
复制
drwxrwxr-x 3 root tunnel 100 date and time .
drwxr-xr-x 33 root root 860 date and time …
-rwxrwxr-x 1 root tunnel 0 date and time enable-updates
drwxrwxr-x 2 root tunnel 40 date and time interface
-rwxrwxr-x 1 root tunnel 151 date and time resolv.conf

但是过了几秒钟或重新启动,所有的都是覆盖的标志,文件resolv.conf和我再次得到这个。

代码语言:javascript
复制
ls -al /run/resolvconf
total 4
drwxrwxr-x  3 root tunnel 100 date and time .
drwxr-xr-x 33 root root   860 date and time ..
-rw-r--r--  1 root root     0 date and time enable-updates
drwxrwxr-x  2 root tunnel  40 date and time interface
-rw-r--r--  1 root root   151 date and time resolv.conf

我不能和你聊天

代码语言:javascript
复制
chattr: Operation not supported while reading flags on /etc/resolv.conf

这是resolv.conf的猫

代码语言:javascript
复制
# 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
EN

回答 1

Unix & Linux用户

发布于 2018-11-23 08:40:54

在编写resolv.conf文件时,每次启动或重新启动网络管理器时都会覆盖该文件

如果您想保持静态DNS,则必须在/etc/network/interfaces文件中添加这一行:

代码语言:javascript
复制
dns-nameservers xxx.xxx.xxx.xxx xxx.xxx.xxx.xxx

在我的示例中,您必须将xxxx.xxxx.xxxx.xxxx替换为所需DNS的IP地址。你可以以谷歌的域名系统8.8.8.88.8.4.4为例。

致以敬意,

票数 2
EN
页面原文内容由Unix & Linux提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://unix.stackexchange.com/questions/483619

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档