Tuesday, June 5, 2012

Port forwarding to a different IP:port using iptables


sysctl net.ipv4.ip_forward=1
iptables -t nat -A PREROUTING -p tcp --dport 3129 -j DNAT --to-destination ip-address:3128
iptables -t nat -A POSTROUTING -j MASQUERADE
iptables -L
iptables -t nat -L -n -v
iptables-save

No comments: