0

I used the following command to create a tunnel from my system to server1 and from server1 to server2 to have a tunnel from my system to server2

ssh -t -t -L4450:localhost:5590 user1@server1 'ssh -L 5590:localhost:2000 user@server2'

But I get the following messages when I try to browse the web in my browser:


channel 3: open failed: connect failed: Connection refused
channel 4: open failed: connect failed: Connection refused

Is there anything wrong with the command?

EDIT:

My goal is to access internet via server2(SOCKS Proxy). Because of some limits, I have to use a interface server(server1) to create a tunnel to server2.

hpn
  • 115

1 Answers1

1

This should be the command:

ssh -t -L4450:localhost:5590 user1@server1 ssh -t -D5590 user@server2

The first ssh does a straight portforward of 4450 to server1, sending packets to its port 5590. The second establishes a connection to server2 with a dynamic portforward (socks proxy) listening on server1 port 5590.

So packets from you going to your localhost:4450 will get forwarded to server1 5590, which is the dynamic port forward sent to server2 and out to the internet from the server2 IP.

Paul
  • 61,193