Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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 10.1.1.100. 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?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

Port forwarding in common case:

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

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

Note: do not forget check FORWARD chain

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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