SSH通过隧道访问远程客户端

时间:2014-01-23 10:54:26

标签: networking ssh tunnel tunneling ssh-tunnel

我是网络相关的新手,我想通过另一台服务器(隧道)访问远程客户端, 例如,用户名为user2和password2的远程客户端11.11.111.111,以及用户名为user1和password1的隧道11.11.10.01

我可以成功ping通地址隧道地址。 但是当我尝试使用cygwin访问远程客户端时:

ssh -vv -o 'ProxyCommand ssh -vv user1@11.11.10.01 nc %h %p' user2@11.11.111.111

我收到此错误:

OpenSSH_6.4, OpenSSL 1.0.1f 6 Jan 2014
debug2: ssh_connect: needpriv 0
debug1: Executing proxy command: exec ssh -vv user1@11.11.10.01 nc 11.11.111.111 22
debug1: permanently_drop_suid: 146765
debug1: identity file /home/user1/.ssh/id_rsa type -1
debug1: identity file /home/user1/.ssh/id_rsa-cert type -1
debug1: identity file /home/user1/.ssh/id_dsa type -1
debug1: identity file /home/user1/.ssh/id_dsa-cert type -1
debug1: identity file /home/user1/.ssh/id_ecdsa type -1
debug1: identity file /home/user1/.ssh/id_ecdsa-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.4
OpenSSH_6.4, OpenSSL 1.0.1f 6 Jan 2014
debug2: ssh_connect: needpriv 0
debug1: Connecting to 11.11.10.01 [11.11.10.01] port 22.
debug1: connect to address 11.11.10.01 port 22: Connection timed out
ssh: connect to host 11.11.10.01 port 22: Connection timed out
ssh_exchange_identification: Connection closed by remote host

我的命令是否正确,有关可能原因的任何想法?

有哪些方法可以排除故障(最好是在我的机器上,而不是在服务器和远程客户端上)?

1 个答案:

答案 0 :(得分:1)

我认为这只是一个部分答案,但尝试用ssh连接到11.11.10.01:

ssh user1@11.11.10.01 -L20022:11.11.111.111:22

然后在另一个窗口连接通过:

ssh user2@127.0.0.1 -p20022

通过这种方式,您将在第一个终端窗口中收到错误。