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 have a following configuration:

internet -> iptables server (also have ssh server) -> local computer (ssh server)

How can I open port 8822 for access from internet to local computer.

share|improve this question

1 Answer 1

up vote 1 down vote accepted
iptables -t nat -A PREROUTING -p tcp --dport 8822 -j DNAT --to-destination localIP:22
iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -m state --state NEW -m tcp -p tcp -d localIP --dport 22 -j ACCEPT
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.