ubuntu不能上网的dns问题

不能上网也就不能apt-get,也就不能

apt-get install resolvconf

所以先修改/etc/resolv.conf,加入dns,如:

nameserver 8.8.8.8

再重启网络:

/etc/init.d/networking restart

这样就可以暂时上网了,若现在重启系统,/etc/resolv.conf会被清空的,就又不能上网了。所以现在,马上执行:

apt-get install resolvconf

完成后编辑/etc/resolvconf/resolv.conf.d/base文件,加入如:

nameserver 8.8.8.8

保存并重启系统,会看到可以永久上网了。