-1

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:

http://img211.imageshack.us/img211/8536/f47067ed35ff487c97db0bf.png

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

8

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.

0

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 10.8.1.1:1338
iptables -t nat -A PREROUTING -p tcp --dport 777 -j DNAT --to 10.8.1.1:777
iptables -t nat -A PREROUTING -p tcp --dport 1122 -j DNAT --to 10.8.1.1:1122
iptables -t nat -A PREROUTING -p tcp --dport 1124 -j DNAT --to 10.8.1.1:1124
iptables -t nat -A PREROUTING -p tcp --dport 1604 -j DNAT --to 10.8.1.1:1604
iptables -t nat -A PREROUTING -p tcp --dport 3030 -j DNAT --to 10.8.1.1:3030
1
  • 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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .