#!/bin/sh IPTABLES=/sbin/iptables EXT_NIC=ath0 INT_NIC=eth0 # flush iptables rules ${IPTABLES} --flush # flush the NAT table ${IPTABLES} --table nat --flush # delete all extra chains ${IPTABLES} --delete-chain # delete all extra chains from the NAT table ${IPTABLES} --table nat --delete-chain # Masquerade packets out on the external interface ${IPTABLES} --table nat --append POSTROUTING --out-interface ${EXT_NIC} -j MASQUERADE # accept and forward packages coming in on the internal interface ${IPTABLES} --append FORWARD --in-interface ${INT_NIC} -j ACCEPT # Accept packets on external interface ${IPTABLES} --table nat --append PREROUTING --protocol tcp --in-interface ${EXT_NIC} -d 192.168.0.13 --dport 5050 -j DNAT --to 192.168.2.2:5050 ${IPTABLES} --table nat --append PREROUTING --protocol tcp --in-interface ${EXT_NIC} -d 192.168.0.13 --dport 113 -j DNAT --to 192.168.2.2:113