/etc/resolv.conf修改后启动自动恢复原样
时间: 2023-08-10 11:05:23 浏览: 109
这可能是由于您的系统正在使用 NetworkManager 来管理网络连接。 NetworkManager 可能会重写 /etc/resolv.conf 文件,以便使用 DHCP 或其他网络配置服务提供的 DNS 服务器。要更改此行为,您可以编辑 /etc/NetworkManager/NetworkManager.conf 文件,并将以下选项添加到 [main] 部分:
```
dns=none
```
然后重新启动 NetworkManager 服务即可。这将禁用 NetworkManager 对 /etc/resolv.conf 文件的自动修改。现在您应该能够更改 /etc/resolv.conf 文件并使更改保持不变。
相关问题
. 哪些文件会影响Linux主机的名称解析功能?(多选题) A./etc/resolv.conf B./etc/hosts C./etc/default/names D./etc/nsswitch.conf E./etc/inet/hosts
影响Linux主机的名称解析功能的文件有:
- /etc/resolv.conf
- /etc/hosts
- /etc/nsswitch.conf
其中,/etc/resolv.conf用于设置DNS服务器的IP地址及DNS域名,/etc/hosts用于本地主机名解析,/etc/nsswitch.conf则定义了系统在解析主机名和服务名时要查找哪些数据源。
因此,正确答案为A、B、D。
8【单选题】以下哪个文件用于设置本地DNS域名服务器? A /etc/nsswitch.conf B /etc/dhcpd.conf c /etc/network/interfaces D /etc/sysctl.conf E /etc/resolv.conf
答案是E:/etc/resolv.conf。
/etc/resolv.conf文件用于设置本地DNS域名服务器。在该文件中,可以指定一个或多个DNS服务器的IP地址,以便系统能够解析域名。
范例:在/etc/resolv.conf文件中设置本地DNS域名服务器的示例:
```shell
nameserver 8.8.8.8
nameserver 8.8.4.4
```
阅读全文
相关推荐
















