0
点赞
收藏
分享

微信扫一扫

ubuntu connect: Network is unreachable的解决方案

英乐 2022-02-19 阅读 216

ubuntu connect: Network is unreachable的解决方法之一

首先查看网卡设置是否正确

sudo vi /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.137.6
netmask 255.255.255.0
gateway 192.168.137.2
dns-nameservers 8.8.8.8 114.114.114.114

查看默认网关是否正确

route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.137.0   0.0.0.0         255.255.255.0   U     0      0        0 eth0

没有即设置默认网关

route add default gw 192.168.137.2

再次查看

route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.137.2   0.0.0.0         UG    0      0        0 eth0
192.168.137.0   0.0.0.0         255.255.255.0   U     0      0        0 eth0

现在即可ping通网关

举报

相关推荐

0 条评论