ubuntu dns设置 ubuntu
程序员文章站
2024-03-22 19:38:06
...
我用的是Ubuntu 14.04.2 LTS, 最近发现一重启ubuntu, 就访问不了任何网站, 发现是重启后dns 重置了,
写道
vi /etc/resolv.conf
:/etc$ 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
:/etc$ 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
resolv.conf自动被重置了。
有2个方法修改这个问题,
第一个方法是修改/etc/network/interfaces
写道
iface eth0 inet static
address 192.168.3.3
netmask 255.255.255.0
gateway 192.168.3.1
dns-search example.com
dns-nameservers 192.168.3.45 192.168.8.10
address 192.168.3.3
netmask 255.255.255.0
gateway 192.168.3.1
dns-search example.com
dns-nameservers 192.168.3.45 192.168.8.10
第二个方法是修改 /etc/resolvconf/resolv.conf.d/base
编辑加入下面这一行
写道
nameserver 8.8.8.8
然后重新产生resolv.conf
写道
sudo resolvconf -u
推荐阅读