#cat /xx/b.sh
ifconfig eth1 down
ifconfig eth1 192.168.0.1
route add 192.168.0.11 dev eth1
arp -i eth1 -s 192.168.0.11 00:0a:75:00:00:33
iptables -t nat -A POSTROUTING -s 192.168.0.1 -d 192.168.0.11 -j SNAT --to-source 192.168.0.11
iptables -t nat -A PREROUTING -s 192.168.0.11 -d 192.168.0.11 -j DNAT --to-destination 192.168.0.1
echo "ping -I 192.168.0.1 192.168.0.11"
#route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
192.168.0.11 0.0.0.0 255.255.255.255 UH 0 0 0 eth1
#arp
Address HWtype HWaddress Flags Mask Iface
192.168.0.11 ether 00:0a:75:00:00:33 CM eth1
#ping -I 192.168.0.1 192.168.0.11
PING 192.168.0.11 (192.168.0.11) from 192.168.0.1: 56 data bytes
64 bytes from 192.168.0.11: seq=0 ttl=64 time=0.344 ms
64 bytes from 192.168.0.11: seq=1 ttl=64 time=0.226 ms
64 bytes from 192.168.0.11: seq=2 ttl=64 time=0.301 ms
64 bytes from 192.168.0.11: seq=3 ttl=64 time=0.300 ms
64 bytes from 192.168.0.11: seq=4 ttl=64 time=0.308 ms
64 bytes from 192.168.0.11: seq=5 ttl=64 time=0.298 ms
^C
--- 192.168.0.11 ping statistics ---
6 packets transmitted, 6 packets received, 0% packet loss
round-trip min/avg/max = 0.226/0.296/0.344 ms
#
#
# dwc-mac 134a0000.ethernet eth1: Link is Down
#
#ping -I 192.168.0.1 192.168.0.11
PING 192.168.0.11 (192.168.0.11) from 192.168.0.1: 56 data bytes
^C
--- 192.168.0.11 ping statistics ---
7 packets transmitted, 0 packets received, 100% packet loss
#
本文通过展示在ARM开发环境中执行的`cat /xx/b.sh`、`route`、`arp`和`ping -I 192.168.0.1 192.168.0.11`等命令,详细阐述了如何进行网口环回测试,以确保设备内部网络通信的正常性。
1700

被折叠的 条评论
为什么被折叠?



