1、问题描述
硬件连接:电脑(有线+无线) <--有线--> CM计算板(或其他Linux),
端口:电脑共享的有线网口 192.168.137.1 , CM3配置静态IP 192.168.137.120/24
CM3ping 不通,报错:
connect: Network is unreachable
2、问题分析
查看路由:route
192.168.137.0 0.0.0.0 255.255.255.0 U 202 0 0 eth0
从192.168.137.0 出去的,应该从192.168.137.1出去,所以增加一条路由即可。
3、解决办法
增加路由
pi@EIRIPI:~$ sudo route add default gw 192.168.137.1
再次查看:route
pi@EIRIPI:~$ routeKernel IP routing tableDestination Gateway Genmask Flags Metric Ref Use Ifacedefault LAPTOP-BETB550K 0.0.0.0 UG 0 0 0 eth0192.168.137.0 0.0.0.0 255.255.255.0 U 202 0 0 eth0
再次测试:
pi@EIRIPI:~$ ping www.baidu.com
PING www.a.shifen.com (14.215.177.38) 56(84) bytes of data.
64 bytes from 14.215.177.38 (14.215.177.38): icmp_seq=1 ttl=53 time=32.8 ms
64 bytes from 14.215.177.38 (14.215.177.38): icmp_seq=2 ttl=53 time=32.9 ms
64 bytes from 14.215.177.38 (14.215.177.38): icmp_seq=3 ttl=53 time=33.3 ms
64 bytes from 14.215.177.38 (14.215.177.38): icmp_seq=4 ttl=53 time=33.5 ms
64 bytes from 14.215.177.38 (14.215.177.38): icmp_seq=5 ttl=53 time=33.5 ms
添加默认路由即可解决。