- busybox traceroute -q 1 -m 1 1.0.0.0 | sed -n 2p | cut -b 5- | cut -d ’ ’ -f 1 | awk ‘$1=$1’
- tb8788p1_64_bsp:/ # busybox traceroute -w 1 -q 1 -m 1 1.0.0.0 | sed -n 2p | cut -b 2-
1 192.168.50.1 (192.168.50.1) 3.360 ms
1|tb8788p1_64_bsp:/ # busybox traceroute -q 1 -m 1 1.0.0.0 | sed -n 2p | cut -b 5- | cut -d ' ' -f 1 | awk '$1=$1'
192.168.50.1
双网卡转发:把eth0上的某个IP请求上网转发wlan0上.
- 先清空iptabes;
iptables -F #注意该命令并不会清空其他表,例如NAT表等
- 在NAT表中添加转发
iptables -t nat -A POSTROUTING -s 192.168.50.100 -o wlan0 -j MASQUERADE #将192.168.50.100的请求全部转发到wifi上.
在9以下此时是可以上网的,但是在9上不行,通过调试发现少了gateway在route表里面,所以用Busybox route -n查看然后添加默认网关
busybox route add default gw 192.168.10.1(your wifi gateway)
tbadfadf_dsfs:/ # iptables -t nat -nvL
Chain PREROUTING (policy ACCEPT 303 packets, 51475 bytes)
pkts bytes target prot opt in out source destination
303 51475 oem_nat_pre all -- * * 0.0.0.0/0 0.0.0.0/0
Chain INPUT (policy ACCEPT 286 packets, 46179 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 2002 packets, 121K bytes)
pkts bytes target prot opt in out source destination
Chain POSTROUTING (policy ACCEPT 2002 packets, 121K bytes)
pkts bytes target prot opt in out source destination
2002 121K tetherctrl_nat_POSTROUTING all -- * * 0.0.0.0/0 0.0.0.0/0
0 0 MASQUERADE all -- * wlan0 192.168.50.100 0.0.0.0/0
Chain oem_nat_pre (1 references)
pkts bytes target prot opt in out source destination
Chain tetherctrl_nat_POSTROUTING (1 references)
pkts bytes target prot opt in out source destination