Reputation: 616
After a day of searching I am unable to replicate the feature with command line for ssh tunnel and reverse tunnel.
reverse ssh tunnel configuration
normal ssh tunnel configuration
with the UI settings above I am able to get it working with instruction on the web!
currently I am trying to do
device 1 connect to (ssh server) and passes its port 80 to port 9191 onto the server then the server relays the port 9191 to device #3.
(device #1 reverse tunnel port 9191 to server device #2) <--> (server device #2 receives port 80 and use it as port 9191 which will relay to device #3) <--> (device #3 with normal tunnel to get port 9191 from device #1 with device #2 being the middle man)
I am able to use the putty user interface to click do get it working, but I am unable to replicate a working situation with command line. ssh command line examples out there do not seem to work.
for example: on reverse tunnel device
ssh -R 9191:localhost:80 root@localhost
on the normal tunnel device
ssh -L 9191:localhost:9191 root@localhost
please let me know if the question is lacking info or unclear thanks!
To clarify my intent, I am trying to make a tunnel between (2 android devices) with a SSH server. I can't SSH directly into an android mobile device simply because of firewall issue, so I have to use a standalone SSH server to act as a middleman to help relay the connection. However if there is any other better options please let me know as well, for example VPN or anything which may not use a lot of battery power on our mobile devices through 3g/wifi.
any other options would be fine but please consider 3g/wifi/firewall/battery consumption/data overhead concerns as well. I am not sure how does the major mobile app handle this, so any new ideas or methods are welcomed.
thanks in advanced
Upvotes: 1
Views: 6387
Reputation: 3722
On Device A
ssh -R 9191:127.0.0.1:80 user@RemoteHost
On Device B
ssh -L 9191:127.0.0.1:9191 user@RemoteHost
Upvotes: 0
Reputation: 19644
As i understand from the comments, you're on Device 1 (Android A), trying to talk to Device 3 (Android B) via Device 2 (SSH host).
Try this on Android A:
ssh -L 9191:android_b:9191 root@ssh_host
On Android B:
ssh -L 9191:android_a:80 root@ssh_host
Or also from Android A:
ssh -R 9191:android_a:80 root@ssh_host
That should serve Android A's port 80 on Android B's port 9191, and that one on Android A's port 9191.
Upvotes: 2