Linux创建完虚拟机centos6后,有时不能上网,ping www.baidu.com时,出现connect: Network is unreachable

Linux创建完虚拟机centos6后,有时不能上网,ping www.baidu.com时,出现connect: Network is unreachable,但ping网关又正常,有可能是本地没有默认的路由

转载于虚拟机centos6 ping 百度时出现Network is unreachable–乾元轩 http://www.imwen.com/post/319.html

问题:创建完虚拟机centos6后,有时不能上网,ping www.baidu.com时,出现connect: Network is unreachable,但ping网关又正常,有可能是本地没有默认的路由
解决:
1、使用ip route查看

192.168.88.0/24 dev eth0 proto kernel scope link src 192.168.88.100
169.254.0.0/16 dev eth0 scope link metric 1002
2、使用route -n查看

Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.88.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 1002 0 0 eth0
3、添加静态的默认路由,即网关

route add default gw 192.168.88.2
4、再次查看路由表
[root@CentOS64 ~]# ip route
192.168.88.0/24 dev eth0 proto kernel scope link src 192.168.88.100
169.254.0.0/16 dev eth0 scope link metric 1002
default via 192.168.88.2 dev eth0
[root@CentOS64 ~]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.88.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 1002 0 0 eth0
0.0.0.0 192.168.88.2 0.0.0.0 UG 0 0 0 eth0
5、测试,成功
[root@CentOS64 ~]# tracepath www.baidu.com
[LOCALHOST] pmtu 1500
1: 192.168.88.2 (192.168.88.2) 0.192ms
2: 192.168.88.2 (192.168.88.2) 0.122ms
@猪十三少 投稿作品

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值