So I have some rules on my server for my VPN, but my partner does port forwarding if needed for my customers. I want to know how to do it myself but he doesn't want to tell me. Now I found these rules on my server, could anyone translate it to the command that was entered? Like the command my partner typed in putty to add this rule, so I can learn from it.

If possible explain what everything does aswell please :).

Picture of rules:


  • 2
    You have a serious problem with your partner, and it has nothing to do with iptables rules. Dec 26, 2012 at 22:37
  • Then how did he manage to port forward these ports?
    – Niel
    Dec 26, 2012 at 22:39

2 Answers 2


If you do

iptables-save > iptables.txt

Will get the iptables commands, you will need to add iptables in front of them to add just the one line

You can use

iptables-restore < iptables.txt

to restore the iptables rules as they are in the in files.
This is useful for backups before changing things.


Read up the iptables man page to see what each switch/flag does.

iptables -t nat -A PREROUTING -p tcp --dport 1338 -j DNAT --to
iptables -t nat -A PREROUTING -p tcp --dport 777 -j DNAT --to
iptables -t nat -A PREROUTING -p tcp --dport 1122 -j DNAT --to
iptables -t nat -A PREROUTING -p tcp --dport 1124 -j DNAT --to
iptables -t nat -A PREROUTING -p tcp --dport 1604 -j DNAT --to
iptables -t nat -A PREROUTING -p tcp --dport 3030 -j DNAT --to
  • The other answer by Epaphus is better; it will allow you to find the commands for any other rules too. Of course, learning it properly is still even better though.
    – fukawi2
    Dec 27, 2012 at 22:11

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.