Friday, September 11, 2015

Simple port forwarding using iptables

 
In case someone else is looking for a way that actually works. Though @HorsePunchKid is right in his suggestion, I've found this walkthrough that fills in the missing steps:
http://www.debuntu.org/how-to-redirecting-network-traffic-to-a-new-ip-using-iptables/
In essence:
Enable IP Forwarding:
sysctl net.ipv4.ip_forward=1
Add your forwarding rule:
iptables -t nat -A PREROUTING -p tcp -d 10.0.0.132 --dport 29418 -j DNAT --to-destination 10.0.0.133: 29418
Ask IPtables to Masquerade:
iptables -t nat -A POSTROUTING -j MASQUERADE
And that's it! It worked for me in any case :)

No comments:

Post a Comment