I am not very well versed in iptables, so I apologize for a bit lame question. What I need to do is to redirect port from a VM running on a private network the outside world.

VM, that is running on a server has, say, ip address I need to forward port 8080 from that VM onto servers port 8080 on interface,say eth1 that is connected to the other private network. How would I do that?


Port forwarding in common case:

iptables -t nat -I PREROUTING -p tcp --dport 8080 -j DNAT --to-destination=

But in same cases you should add some SNAT's or change routing.

Note: do not forget check FORWARD chain

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.