- ssh tunnel

PDA

View Full Version : ssh tunnel


/dev/null
07-24-2004, 10:09 PM
I have a remote email server that we'd like to ssh tunnel to. We want all
110 and 25 traffic to go across secured.

We have a local linux box with a LAN IP of 192.168.1.1, the remote email
server is also linux. I'd like to have our mail clients set up to access
192.168.1.1 which would then securely forward the traffic to the external
mail server like this:

internal box -> 192.168.1.1:7025 -> mail.server.com:25

I thought this command would do it (on the 192.168.1.1 box):

ssh -f -N -L7025:192.168.1.1:25 mail.server.com

but when I do a `netstat -nl` I see that ssh is binding to 127.0.0.1:7025.
No matter what I put in as the second parameter for -L I can't get it to
listen to any other ip than localhost.

What gives? Shouldn't this work? Or will I have to netcat 192.168.1.1:7025
to localhost:7025?

Thanks!

Ian Northeast
07-24-2004, 10:09 PM
/dev/null wrote:
>
> I have a remote email server that we'd like to ssh tunnel to. We want all
> 110 and 25 traffic to go across secured.
>
> We have a local linux box with a LAN IP of 192.168.1.1, the remote email
> server is also linux. I'd like to have our mail clients set up to access
> 192.168.1.1 which would then securely forward the traffic to the external
> mail server like this:
>
> internal box -> 192.168.1.1:7025 -> mail.server.com:25
>
> I thought this command would do it (on the 192.168.1.1 box):
>
> ssh -f -N -L7025:192.168.1.1:25 mail.server.com
>
> but when I do a `netstat -nl` I see that ssh is binding to 127.0.0.1:7025.
> No matter what I put in as the second parameter for -L I can't get it to
> listen to any other ip than localhost.

ssh -f -N -g -L 7025:localhost:25 mail.server.com.

The second parameter is what the tunnel connects to and is interpreted
at the far end. The -g parameter allows other hosts to connect to the
local end.

Regards, Ian

Sak Wathanasin
07-24-2004, 10:09 PM
In article <jvqmb.10278$mZ5.63515@attbi_s54>,
"/dev/null" <dev.null@BeginThread.com> wrote:

> but when I do a `netstat -nl` I see that ssh is binding to 127.0.0.1:7025.
> No matter what I put in as the second parameter for -L I can't get it to
> listen to any other ip than localhost.

Try "-g" to allow other hosts on your LAN to use the tunnel.

--

Sak Wathanasin
Network Analysis Limited
http://www.network-analysis.ltd.uk

/dev/null
07-24-2004, 10:09 PM
-g did the trick!

many thanks.