dasheng0 2018-03-20
if [ -z "`iptables -t nat -L | grep REDIRECT | grep udp | grep 10162`" ]; then iptables -t nat -A PREROUTING -p udp -m udp --dport 162 -j REDIRECT --to-ports 10162 fi chmod +x /etc/init.d/boot.local sed -i '/iptables -t nat -A PREROUTING -p udp -m udp --dport 162 -j REDIRECT --to-ports 10162/d' /etc/init.d/boot.local sed -i '$a\iptables -t nat -A PREROUTING -p udp -m udp --dport 162 -j REDIRECT --to-ports 10162' /etc/init.d/boot.local
while [ -n "`iptables -t nat -L | grep REDIRECT | grep udp | grep 10162`" ]; do iptables -t nat -D PREROUTING -p udp -m udp --dport 162 -j REDIRECT --to-ports 10162 >/dev/null 2>&1 done sed -i '/iptables -t nat -A PREROUTING -p udp -m udp --dport 162 -j REDIRECT --to-ports 10162/d' /etc/init.d/boot.local