echo 0 > /proc/sys/net/ipv4/ip_forward
/system/bin/iptables -t nat -A natctrl_nat_POSTROUTING -o eth0 -j MASQUERADE
/system/bin/iptables -A natctrl_FORWARD -i eth0 -o ap0 -m state --state ESTABLISHED,RELATED -g natctrl_tether_counters
/system/bin/iptables -A natctrl_FORWARD -i ap0 -o eth0 -m state --state INVALID -j DROP
/system/bin/iptables -A natctrl_FORWARD -i ap0 -o eth0 -g natctrl_tether_counters
/system/bin/iptables -A natctrl_tether_counters -i ap0 -o eth0 -j RETURN
/system/bin/iptables -A natctrl_tether_counters -i eth0 -o ap0 -j RETURN
/system/bin/iptables -D natctrl_FORWARD -j DROP
/system/bin/iptables -A natctrl_FORWARD -j DROP
echo 1 > /proc/sys/net/ipv4/ip_forward
其中,ap0是連接內網的網卡,eth0是連接外網的網卡。