I've tried to create a tunnel torward a client passed through a server, using the following command
ssh -X -f admin@IP_server -N -L 4444:IP_client:80
but when try to open client:80 by firefox receive as error this
channel 2: open failed: unknown channel type:
Connection to 81.21.20.207 closed by remote host.
someone knows where is the issue? thanks so much
Here's what I use to load my webmin on my servers (which is firewalled away so only somebody with ssh access can see it):
That connects me to the server and maps my local port 9090 to the server's P9090. I just browse at
http://localhost:9090/
and I can see the webmin.If you're trying to connect to another device through your server, you don't really want to faff around with manual tunnel options.
ssh
has a built-in SOCKS proxy mode. Run this:Then you tell your browser about the SOCKS proxy. Look under the network settings.
localhost
as the server, port9999
. Remember this has to be under the setting for SOCKS. This is not a HTTP proxy.Now when you browse, all the traffic goes through the ssh tunnel. This means if there's a device on the other end that only your server can reach, you can connect to that using its IP.
Note that DNS lookups and other network traffic won't go through the tunnel (AFAIK) so you need to connect to an IP if it makes a difference (which I suspect it will in this case)
You want a reverse Tunnel, try this:
What this does is initiate a connection to remote.mydomain.com and forwards TCP port 4444 on remote.mydomain.com to TCP port 80 on local.mydomain.com. "-N" tells ssh to just set up the tunnel and not to prepare a command stream, and "-T" tells ssh not to allocate a pseudo-tty on the remote system. The "-R" option tells ssh to set up the tunnel as a reverse tunnel.
Your description is confusing. As specified, you have told it that connections to
localhost:4444
are to be forwarded toIP_server
which should then connect toIP_client:80
, but then you are connecting directly toIP_client:80
?