![无法在我的本地计算机和开放式 Solaris 服务器之间进行隧道反向连接](https://linux22.com/image/544592/%E6%97%A0%E6%B3%95%E5%9C%A8%E6%88%91%E7%9A%84%E6%9C%AC%E5%9C%B0%E8%AE%A1%E7%AE%97%E6%9C%BA%E5%92%8C%E5%BC%80%E6%94%BE%E5%BC%8F%20Solaris%20%E6%9C%8D%E5%8A%A1%E5%99%A8%E4%B9%8B%E9%97%B4%E8%BF%9B%E8%A1%8C%E9%9A%A7%E9%81%93%E5%8F%8D%E5%90%91%E8%BF%9E%E6%8E%A5.png)
我想反向隧道连接到我的 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 等...)