问题描述:
在刚刷新完固件的开发板上配置网络时,设置好IP 地址后,在ping其他网络时,提示:SIOCADDRT: Network is unreachable
原因分析:
错误提示的表面意思是:网络不可达。
然后使用route命令,查看网络情况。发现列表中没有设置网关。
3519AV100 ~ # route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
解决方案:
增加网关设置
3519AV100 ~ # route add default gw 192.168.10.1
然后再用route指令,检测一下。
3519AV100 ~ # route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default 192.168.10.1 0.0.0.0 UG 0 0 0 eth0
192.168.10.0 * 255.255.255.0 U 0 0 0 eth0
最后再ping一下可用网络,看是否可以ping通
3519AV100 ~ # ping 192.168.10.34
PING 192.168.10.34 (192.168.10.34): 56 data bytes
64 bytes from 192.168.10.34: seq=0 ttl=63 time=0.690 ms
64 bytes from 192.168.10.34: seq=1 ttl=63 time=0.809 ms
64 bytes from 192.168.10.34: seq=2 ttl=63 time=0.815 ms
可以看到有通信数据,因此网关配置成功。