I want to reverse tunnel connection to my SunOS (Joyent) so that any connections coming to 12043 on this server will be served by my local development server running at localhost:8843.
Edit: I don't know why but SO is not formatting my post properly (damn). Any experienced guy please help edit my post
So here what I do:
Start my local server at port 8843
$ telnet localhost 8843
Connected to localhost.
Escape character is '^]'.
Connect to server
$ ssh -vgR *:12043:0.0.0.0:8843 email@example.com
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
Then do a check
$ telnet myhost.com 12043
telnet: connect to address x.x.x.x: Connection refused
telnet: Unable to connect to remote host