我的/etc/resolv.conf
文件每次都会重新生成,这让我在重新连接 3G 调制解调器时失去了 Google DNS 服务器。
为了更改 DNS 设置,我查看了http://code.google.com/intl/fr-FR/speed/public-dns/docs/using.html。
我dhclient.conf
的非常大(58 行),所以我把它贴在了pastebin 上。
但是,这里是整个dhclient.conf
没有注释行或空行:
option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;
send host-name "<hostname>";
request subnet-mask, broadcast-address, time-offset, routers,
domain-name, domain-name-servers, domain-search, host-name,
netbios-name-servers, netbios-scope, interface-mtu,
rfc3442-classless-static-routes, ntp-servers;
prepend domain-name-servers 8.8.8.8, 8.8.4.4;
Run Code Online (Sandbox Code Playgroud)
我正在使用wvdial
而不是网络管理器。
在 12.04 中,默认安装了 resolvconf。以下是如何针对一些常见用例更改 DNS 配置的快速摘要:
对于使用ifup
、使用dns-nameservers
和 中的dns-search
条目的静态配置/etc/network/interfaces
。
对于使用 的静态配置NetworkManager
,请在连接编辑器Automatic (DHCP) addresses only
Method
的Additional DNS servers
和Additional search domains
字段中选择并输入地址和域名。
要覆盖需要resolvconf的默认配置,使用base
,head
并tail
在/etc/resolvconf/resolv.conf.d/
。仅在这些文件中输入地址和域名作为临时措施,因为它们确实属于其他地方,如上所述。
不建议禁用 resolvconf,但您可以用/etc/resolv.conf
常规文件替换符号链接。
有关更多信息,请参阅 Stéphane Graber 的博客文章。
如果您只想将 Google DNS 服务器保留在 resolv.conf 中,您可以编辑
/etc/dhcp3/dhclient.conf
并添加:
prepend domain-name-servers 8.8.8.8;
prepend domain-name-servers 8.8.4.4;
Run Code Online (Sandbox Code Playgroud)
你所拥有的和我在这里展示的唯一区别是,根据你提到的文档,你在一行上拥有两个名称服务器。
除非我遗漏了什么,否则你的 dhclient.conf 在这里不是问题。此时,我假设问题与 wvdial 有关。
以下是来自ubuntuforums的一些可以尝试的东西:
gksudo gedit /etc/ppp/peers/wvdial
Run Code Online (Sandbox Code Playgroud)
删除参数 usepeerdns 并保存文件。代码:
gksudo gedit /etc/wvdial.conf
Run Code Online (Sandbox Code Playgroud)
添加这些行:
check DNS = no
auto DNS = no
Run Code Online (Sandbox Code Playgroud)
小智 -1
您可能已经安装了数据包 resolvconf。在这种情况下,每当出现界面时,resolv.conf 就会更新。您可以使用 /etc/resolv.conf.tail 文件添加静态条目,有关更多信息,请参阅 resolv.conf 的手册页。
归档时间: |
|
查看次数: |
20033 次 |
最近记录: |