Koozali.org: home of the SME Server

Legacy Forums => Experienced User Forum => Topic started by: dwater on July 12, 2005, 05:59:05 AM

Title: port forwarding from the command line
Post by: dwater on July 12, 2005, 05:59:05 AM
Hi,

I have been using the web interface to forward ports through my SME server.

This works fine. However, I am finding I am doing it quite often while I am working on the development of various things.

Is there a way of doing the same thing from the command line using single commands so I can make my own command file with 'sh' (or such like)?

Max.
Title: Re: port forwarding from the command line
Post by: gordonr on July 22, 2005, 07:03:13 AM
Quote from: "dwater"

Is there a way of doing the same thing from the command line using single commands so I can make my own command file with 'sh' (or such like)?


It's a little ugly at the moment. You know the drill - you can break things by putting the wrong things into the config db - be careful.

Code: [Select]
sudo /sbin/e-smith/db configuration getprop masq TCPForwards
1234,localhost:22


OK, so that's a forward from port 1234 to port 22.

Now, expand the list with the new entry:

Code: [Select]
sudo /sbin/e-smith/db configuration setprop masq TCPForwards \
1234,localhost:22,3333,localhost:33


and then

Code: [Select]
sudo /sbin/e-smith/signal-event portforwarding-update

There's a "New Feature Request" in for 7.0 development to change port forwards into their own db. Whether there'll be time before 7.0 is something we'll have to wait and see:

https://sourceforge.net/tracker/index.php?func=detail&aid=1242001&group_id=96750&atid=615772

Gordon
Title: Re: port forwarding from the command line
Post by: dwater on July 22, 2005, 08:13:55 AM
Quote from: "gordonr"
Quote from: "dwater"

Is there a way of doing the same thing from the command line using single commands so I can make my own command file with 'sh' (or such like)?


It's a little ugly at the moment. You know the drill - you can break things by putting the wrong things into the config db - be careful.

Code: [Select]
sudo /sbin/e-smith/db configuration getprop masq TCPForwards
1234,localhost:22


OK, so that's a forward from port 1234 to port 22.

Now, expand the list with the new entry:

Code: [Select]
sudo /sbin/e-smith/db configuration setprop masq TCPForwards \
1234,localhost:22,3333,localhost:33


and then

Code: [Select]
sudo /sbin/e-smith/signal-event portforwarding-update

There's a "New Feature Request" in for 7.0 development to change port forwards into their own db. Whether there'll be time before 7.0 is something we'll have to wait and see:

https://sourceforge.net/tracker/index.php?func=detail&aid=1242001&group_id=96750&atid=615772

Gordon


OK, thanks!

Max.
Title: port forwarding from the command line
Post by: Reinhold on July 23, 2005, 01:13:22 AM
Gordon,

Is there a fast and reasonably safe way
to sort the  masq TCPForwards  entries in the database
via commandline ?

Why?
Well...after one has done a couple of forwardigs
- then removed them when no longer needed,
then added others,
...the forwarding panel is a mess...
it's neither sorted by port no.
nor by client ip

Sure takes patience to clean up via the admin console
(hope you understand what I mean)

Regards
Reinhold
Title: port forwarding from the command line
Post by: gordonr on July 23, 2005, 07:47:00 AM
Quote from: "Reinhold"

Is there a fast and reasonably safe way
to sort the  masq TCPForwards  entries in the database
via commandline ?


No. Storing the port forwards in their own db would make this a little easier. Anyway, the correct fix is in the panel to display them in sorted order. To the bug tracker please - thanks.

Gordon