tips:iptables

This is an old revision of the document!


IPTables

SNAT and DNAT

IPLOCAL=a.b.c.d
IPREMOTE=x.y.z.w

echo 1 > /proc/sys/net/ipv4/ip_forward

iptables -t nat -A PREROUTING -p tcp --dport 33307 -j DNAT --to-destination ${IPREMOTE}:3306
iptables -t nat -A POSTROUTING -p tcp -d ${IPREMOTE} --dport 3306 -j SNAT --to-source ${IPLOCAL}
  • tips/iptables.1437480857.txt.gz
  • Last modified: 2015/07/21 14:14
  • by scipio