www.libssh2.org | Daily snapshots | Mailing list archive | Docs | Examples | github

Archive Index This month's Index

Subject: Re: ssh tunneling

Re: ssh tunneling

From: A. Mark <gougolith_at_gmail.com>
Date: Tue, 9 Feb 2010 09:54:17 -0800

How do you want to access the internal host?

I'd like to be able establish an ssh session to a private host (hostPrivate)
on a network where one of the hosts (hostPublic) has an external IP to the
internet (perhaps through port forwarding via router). So both hosts have
sshd and port 22 open, you may ssh into hostPublic from anywhere on the
internet, however you cannot ssh into hostPrivate because it's only visible
from the subnet. So you may ssh into hostPrivate from hostPublic since they
are on the same subnet or LAN for example.

> For an example of how to use a direct-tcpip SSH channel (this is the
> term for channels used for outbound TCP connections from the sshd)
> please see example/direct_tcpip.c.

I'm sorry but I don't understand how this has anything to do with what I'm
trying to do.

> As you can see in that file you must manually pump data through the
> first connection. Since libssh2 requires a fd also for the second
> connection you must use pipe() and manually copy data from the first
> libssh2 connection into that pipe, and vice versa.

I would like know how do you make the second connection without being able
to see the IP of that host. What is fd?

> Yes - why do you bring this up?

Because I thought someone might know how to use putty to do this and
understand what i'm trying to do with libssh2...
The procedure should be similar as they are both clients.

What I figured out so far is that I need to forward the connection via an
ssh tunnel within the LAN from hostPrivate to hostPublic. There is a
procedure to do it with ssh commands and settings. So far it turned out I'm
not sure that my question had anything to do with libssh2 or if it's
possible or even feasable to use it in any way for my purposes. Please let
me know.

Thank you!


libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2010-02-09

the libssh2 team