ubuntu12.04的dns配置重启丢失问题

前端之家收集整理的这篇文章主要介绍了ubuntu12.04的dns配置重启丢失问题前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

解决方法

请etc/resolvconf/resolv.conf.d这个目录下,添加一个文件文件填写你相对应的网络的DNS的配置,如电信的网络,则添加nameserve 202.96.134.133

这里我添加文件名字叫tail,在该文件添加以下内容

root@galen:/etc/resolvconf/resolv.conf.d# cat tail
nameserver 202.96.134.133
nameserver 202.96.128.68

使用:wq!保存一下。

最后你尝试进行 apt-get update(根用户下),会出现以下现象:

Hit http://security.ubuntu.com precise-security/universe Sources
Hit http://security.ubuntu.com precise-security/multiverse Sources
Hit http://security.ubuntu.com precise-security/main i386 Packages
Hit http://security.ubuntu.com precise-security/restricted i386 Packages
Hit http://security.ubuntu.com precise-security/universe i386 Packages
Hit http://security.ubuntu.com precise-security/multiverse i386 Packages
Hit http://security.ubuntu.com precise-security/main TranslationIndex
Hit http://security.ubuntu.com precise-security/multiverse TranslationIndex
Hit http://security.ubuntu.com precise-security/restricted TranslationIndex
Hit http://extras.ubuntu.com precise/main Sources
Hit http://security.ubuntu.com precise-security/universe TranslationIndex
Hit http://security.ubuntu.com precise-security/main Translation-en
Hit http://security.ubuntu.com precise-security/multiverse Translation-en
Hit http://extras.ubuntu.com precise/main i386 Packages
Ign http://extras.ubuntu.com precise/main TranslationIndex
Hit http://security.ubuntu.com precise-security/restricted Translation-en
Hit http://security.ubuntu.com precise-security/universe Translation-en
Ign http://extras.ubuntu.com precise/main Translation-en_US
Ign http://extras.ubuntu.com precise/main Translation-en
Fetched 72 B in 7s (9 B/s)
Reading package lists... Done

root@galen:~#

到了这步,恭喜你,DNS的配置重启丢失问题已解决了。

注意:你不能在直接进行以下的操作:

root@galen:~# vi /etc/resolv.conf
# 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
nameserver 202.96.134.133
nameserver 202.96.128.68

这样重启后就会清空该文件内容了。

猜你在找的Ubuntu相关文章