[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Dynamic port opening and forwarding?

Hi all!

I want to open and forward a port on my gateway kinda dynamically.
I.e. I want to open port 3898/TCP and forward it to

As far as I got the manuals right this can be done using iptables.
So I wrote a small batch file which is using 3 parameters, the IP adress and
the port. This batch is to be called when I need it, so after the
connection of my gateway is already established.

Calling "./portfwd 3898 TCP" should do the trick.

Here's my batch...

iptables -A xtaccess -p $3 --dport $2 -j ACCEPT
iptables -A portfwf -p $3 -m state --state NEW -d $1 --dport $2 -j ACCEPT

But it doesn't seem to work, although there are no error messages at all. :/

The rules are visible, when i use "iptables --list".

Any hints someone? Would be great.


Reply to: