Ubuntu系统重启后/etc/resolv.conf内容丢失
来源:互联网 发布:dota2比赛数据未找到 编辑:程序博客网 时间:2024/06/07 04:42
简介
简要介绍如何解决Ubuntu系统重启后/etc/resolv.conf内容丢失问题,或者说解决永久保存/etc/resolv.conf配置问题。
方案1 通过/etc/network/interfaces配置
通过向/etc/network/interfaces接口配置文件追加dns-nameserver和dns-search项来永久保存配置,保存完成后执行"sudo service networing restart"重启网络来触发更新/etc/resolv.conf文件。
The ifup program can be used to configure network interfaces according to settings in /etc/network/interfaces. To make ifup push nameserver information to resolvconf when it configures an interface the administrator must add dns- option lines to the relevant iface stanza in interfaces(5). The following option names are accepted: dns-nameserver, dns-search, and dns-sortlist. To add a nameserver IP address, add an option line consisting of dns-nameserver and the address. To add multiple name server addresses, include multiple such dns-nameserver lines. dns-nameserver 192.168.1.254 dns-nameserver 8.8.8.8 To add search domain names, add a line beginning with dns-search. dns-search foo.org bar.com The dns-nameservers option is also accepted and, unlike dns-nameserver, can be given multiple arguments, separated by spaces. The dns-domain option is deprecated in favor of dns-search. The resulting stanza might look like the following example. iface eth0 inet static address 192.168.1.3 netmask 255.255.255.0 gateway 192.168.1.1 dns-nameserver 192.168.1.254 dns-nameserver 8.8.8.8 dns-search foo.org bar.com
方案2 通过resolvconf实现配置
resolvconfig应用可以实现DNS信息管理,可以通过下面的应用来安装此组件:
sudo apt-get install resolvconf创建/etc/default/resolvconf缺省配置文件,添加相关环境变量
bob@ubuntu:/etc/resolvconf/resolv.conf.d$ cat /etc/default/resolvconf TRUNCATE_NAMESERVER_LIST_AFTER_127=no该环境变量影响保存到/etc/resolv.conf的DNS配置条数。向/etc/resolvconf/resolv.conf/base配置文件中添加DNS配置项。
bob@ubuntu:/etc/resolvconf/resolv.conf.d$ cat basenameserver 10.220.0.11nameserver 10.220.0.12search infinera.com使用下列配置命令使配置生效
sudo resolvconf -u
总结
以上两种配置方式均可实现/etc/resolv.conf配置永久保存功能,更具体的信息可以查看"man resolvconf"手册。
0 0
- Ubuntu系统重启后/etc/resolv.conf内容丢失
- Ubuntu 中/etc/resolv.conf 文件修改丢失的解决方案
- /etc/resolv.conf 的更改在重启后丢失的解决办法
- /etc/resolv.conf 的更改在重启后丢失的解决办法
- /etc/resolv.conf 的更改在重启后丢失
- /etc/resolv.conf 的更改在重启后丢失的解决办法
- /etc/resolv.conf 的更改在重启后丢失的解决办法
- ubuntu dns文件/etc/resolv.conf详解
- ubuntu resolv.conf 重启丢失
- /etc/resolv.conf
- /etc/resolv.conf
- Linux /etc/resolv.conf
- ubuntu网络重启后或主机重启后,/etc/resolv.conf恢复原样的解决办法
- Ubuntu 12.04 每次重启后,/etc/resolv.conf里面设置的nameserver就被清空
- ubuntu 11.10 /etc/resolv.conf文件重启被清除,dns设置
- 解决ubuntu下/etc/resolv.conf重启被复写问题
- 解决ubuntu下resolv.conf 丢失domain, search 配置
- Linux系统resolv.conf配置信息丢失的解决方法
- react-native之flex布局总结
- oracle中三大类型与隐式数据类型转换
- caffe2 在树莓派raspberry Pi 3b平台应用(一 源码编译注意事项)
- 并查集总结
- caffe2 介绍
- Ubuntu系统重启后/etc/resolv.conf内容丢失
- win10 禁用更新
- SQL&&SQLPLUS语句的特点,单双引号出现的位置
- POJ_1159_Palindrome【dp】
- where和having的区别
- Office 2010激活工具: Office 2010 Toolkit
- Oracle EBS财务模块(五)日记账
- jdbc批量操作
- Gradle构建多模块项目