Ubuntu network is unreachable解决方法

ifconfig什么地址都没有,ping其他主机就提示Ubuntu network is unreachable。

1.手动设置IP:
vim /etc/network/interfaces
增加eth0:
auto eth0
#iface eth0 inet dhcp

pre-up ifconfig eth0 hw ether 08:00:27:75:1F:16
iface eth0 inet static
address xxx.xxx.xxx.xxx
netmask xxx.xxx.xxx.xxx
gateway xxx.xxx.xxx.xxx
auto eth0 #开机自动连接
iface eth0 inet static #static表示使用固定ip,dhcp表示使用动态ip
2.手动设置DNS
linux系统的DNS信息是保存在/etc/resolv.conf ,但是不能直接修改这个文件。

在/etc/resolvconf/resolv.conf.d/目录下一般情况下这个目录下有base和head两个文件pre
vim /etc/resolvconf/resolv.conf.d/base
nameserver 8.8.8.8
保存后执行
resolvconf -u
3.用以下命令使网络设置生效
service networking restart

sudo /etc/init.d/networking restart

猜你喜欢

转载自www.cnblogs.com/Qi-gege/p/10634956.html