JZ2440 ping不通电脑的一种可能原因 PING 192.168.88.226 (192.168.88.226): 56 data bytes

在Uboot下还没有关闭防火墙前

OpenJTAG> ping 192.168.88.226
ERROR: resetting DM9000 -> not responding
dm9000 i/o: 0x20000000, id: 0x90000a46 
DM9000: running in 16 bit mode
MAC: 08:00:3e:26:0a:5b
could not establish link
checksum bad
ping failed; host 192.168.88.226 is not alive

在Uboot下关闭防火墙后

OpenJTAG> ping 192.168.88.226 
ERROR: resetting DM9000 -> not responding
dm9000 i/o: 0x20000000, id: 0x90000a46 
DM9000: running in 16 bit mode
MAC: 08:00:3e:26:0a:5b
could not establish link
host 192.168.88.226 is alive

根据网上的说法如果看到 host 某某 is alive,说明是通的。

在启动kernel后,未关闭防火墙,ping百度(119.75.217.56)无法ping通

# ping 119.75.217.56
PING 119.75.217.56 (119.75.217.56): 56 data bytes
ping: sendto: Network is unreachable

 ping不通是因为我的开发板设置的IP和路由器不在同一网段,并且网关也需要设置对

先查询当前的ip看是不是和路由器同一网段

# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:60:6E:33:44:55  
          inet addr:192.168.1.17  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:18 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1440 (1.4 KiB)  TX bytes:0 (0.0 B)
          Interrupt:51 Base address:0xa000 

将开发板设置为和电脑同一网段,并设置默认网关

# ifconfig eth0 192.168.88.158

设置默认网关

# route add default gw 192.168.88.1

查看设置后的IP和默认网关是否正确

# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:60:6E:33:44:55  
          inet addr:192.168.88.158  Bcast:192.168.88.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:29 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:2336 (2.2 KiB)  TX bytes:0 (0.0 B)
          Interrupt:51 Base address:0xa000 

确保正确后,继续ping百度(ping 119.75.217.56)

# ping 119.75.217.56
PING 119.75.217.56 (119.75.217.56): 56 data bytes
64 bytes from 119.75.217.56: seq=0 ttl=55 time=42.313 ms
64 bytes from 119.75.217.56: seq=1 ttl=55 time=36.514 ms
64 bytes from 119.75.217.56: seq=2 ttl=55 time=36.649 ms
64 bytes from 119.75.217.56: seq=3 ttl=55 time=36.561 ms

有数据回复证明已经成功ping通百度,能ping通外网按理来说应该是可以ping通电脑的,但出乎我的意料

# ping 192.168.88.226
PING 192.168.88.226 (192.168.88.226): 56 data bytes

返回数据让我傻眼,百度了很久还是没有找到原理,后来看到百度:开发板ping 不通电脑,看到有防火墙问题,于是尝试关闭防火墙,关闭防火墙后在去ping电脑(关闭防火墙步骤:控制面板-_>系统和安全-->Windows 防火墙-->打开或关闭防火墙-->关闭window防火墙-->确定,注意家庭和公共网络两个地方都关闭)

# ping 192.168.88.226
PING 192.168.88.226 (192.168.88.226): 56 data bytes
64 bytes from 192.168.88.226: seq=0 ttl=128 time=1.299 ms
64 bytes from 192.168.88.226: seq=1 ttl=128 time=1.307 ms
64 bytes from 192.168.88.226: seq=2 ttl=128 time=2.443 ms
64 bytes from 192.168.88.226: seq=3 ttl=128 time=1.840 ms

看到这个数据我高兴起来了,因为已经ping通电脑

参考

https://blog.csdn.net/thisway_diy/article/details/88184822

https://blog.csdn.net/longintchar/article/details/71250060

https://www.cnblogs.com/zzb-Dream-90Time/p/9002490.html

猜你喜欢

转载自blog.csdn.net/lxj362343/article/details/89608303