Ubuntu不能上网的解决方案

当DHCP服务器出问题的时候,不能自动分配ip,就需要手动设置静态ip。

1、vim /etc/network/interfaces(个人不是很习惯用vim,可以换成gedit就和记事本一样操作啦)
2、修改文件内容举例如下:(我的不叫eth0,是enp2s0,输入ifconfig看第一个)

auto eth0
iface eth0 inet static
address 192.168.0.124
netmask 255.255.255.0
gateway 192.168.0.1
broadcast 192.168.0.255


3、配置DNS解析器,vim /etc/reslov.conf,输入
nameserver 8.8.8.8 (8.8.8.8谷歌的DNS解析器,可能比较慢)
nameserver 114.114.114.114

4、重启网络sudo /etc/init.d/networking restart

猜你喜欢

转载自blog.csdn.net/u012114090/article/details/80362031