我想反向隧道连接到我的 SunOS(Joyent),以便任何到该服务器上 12043 的连接都将由运行在 localhost:8843 的本地开发服务器提供服务。
编辑:我不知道为什么,但 SO 没有正确格式化我的帖子(该死)。有经验的人请帮忙编辑我的帖子
所以我这样做了:
在端口 8843 启动我的本地服务器
$ telnet localhost 8843
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.连接到服务器
$ ssh -vgR *:12043:0.0.0.0:8843 [email protected]
OpenSSH_5.2p1, OpenSSL 0.9.8l 5 Nov 2009 debug1: Reading configuration data /x/x/.ssh/config debug1: Reading configuration data /etc/ssh_config debug1: Connecting to myhost.com [x.x.x.x] port 22. debug1: Connection established. debug1: identity file /x/x/.ssh/identity type -1 debug1: identity file /x/x/.ssh/id_rsa type 1 debug1: identity file /x/x/.ssh/id_dsa type 2 debug1: Remote protocol version 2.0, remote software version Sun_SSH_1.4 debug1: no match: Sun_SSH_1.4 debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_5.2 debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: server->client aes128-ctr hmac-md5 none debug1: kex: client->server aes128-ctr hmac-md5 none debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP debug1: SSH2_MSG_KEX_DH_GEX_INIT sent debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY debug1: Host 'eastagile.com' is known and matches the RSA host key. debug1: Found key in /x/x/.ssh/known_hosts:65 debug1: ssh_rsa_verify: signature correct debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: SSH2_MSG_NEWKEYS received debug1: SSH2_MSG_SERVICE_REQUEST sent debug1: SSH2_MSG_SERVICE_ACCEPT received debug1: Authentications that can continue: gssapi-keyex,gssapi-with-mic,publickey,password,keyboard-interactive debug1: Next authentication method: publickey debug1: Offering public key: eastagile5 debug1: Server accepts key: pkalg ssh-dss blen 433 debug1: Authentication succeeded (publickey). debug1: Remote connections from *:12043 forwarded to local address 0.0.0.0:8843 debug1: channel 0: new [client-session] debug1: Entering interactive session. debug1: remote forward success for: listen 12043, connect 0.0.0.0:8843 debug1: All remote forwarding requests processed Last login: Wed Mar 30 09:47:43 2011 from y.y.y然后检查
$ telnet myhost.com 12043
Trying x.x.x.x...
telnet: connect to address x.x.x.x: Connection refused
telnet: Unable to connect to remote host
答案1
尝试将 0.0.0.0 替换为你实际想要转发连接的 IP到.例如:
ssh -vgR *:12043:localhost:8843 [email protected]
答案2
您检查过服务器的 sshd_config 吗?
我自己已经有一段时间没有使用过 solaris 了,不过你一定有
GatewayPorts yes
为了使其正常工作,在 RHEL 和派生发行版(CentOS 等...)