Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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


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.