Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Networking
User Name
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.


  Search this Thread
Old 04-05-2016, 04:20 PM   #1
LQ Newbie
Registered: Jun 2009
Posts: 14

Rep: Reputation: 0
Question SSH tunnel alternative for non-stable internet connection with dynamic IP address

I need organize persistent SSH access to my device (Android tablet) from Internet, that have very poor not stable internet connection via cellular network and dynamic or gray IP address.

There are many apps that can listen ports on device external IP, but main problem is that most of Russian (and, I think, many other countries) cellular providers (GPRS, 3G, LTE, etc) close all ports from external access, even if device have white IP address. So via cellular network there are no way directly connect to device, and I can get direct access device only via WiFi neworks.

I want find any way for organize persistent access to my device via static address and port. The way where I don't need to check current wifi ip address of each network and type it for give access, but use something stable like

Popular way for this is organize SSH Tunnel via external ssh server with white IP address. I have the server and already try this way (SSHDroid app as SSH server with bind to localhost:2222 port; SSH Autotunnel app for organize tunnel), but the problem is with too slow reconnecting after Android device change IP address (got reconnect on cellular network, or swith to/from WiFi) - problem with establishing new connection can continue about 10-30 minutes - this is too long.

So the Question: Is there any way to organize stable direct TCP/IP access to custom port (I need to use ssh&sftp protocol) on Android or another Linux device, that work normally and reconnects quickly on unstable network with often reconnects and switch wifi/3g network.
Old 04-06-2016, 06:46 AM   #2
LQ Guru
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS, Manjaro
Posts: 5,786

Rep: Reputation: 2773Reputation: 2773Reputation: 2773Reputation: 2773Reputation: 2773Reputation: 2773Reputation: 2773Reputation: 2773Reputation: 2773Reputation: 2773Reputation: 2773
more than one way....

Have you considered using a VPN that supports dynamic home redirection such as ?

You might also address by name and use one of the dynamic DNS servers. You drop a client piece in your server and it 'phones home' to a DNS server with your external IP address, and publishes a FQDN with that address. Then you set up using the name instead of the IP address, and it resolves to the correct address for the connection.

Both use, and I think you require, some resource outside the two endpoints to allow them to make that initial connection independent of the IP addresses involved.
Old 04-06-2016, 01:29 PM   #3
LQ Newbie
Registered: Jun 2009
Posts: 14

Original Poster
Rep: Reputation: 0
wpeckham, thanks for quick reply! If I configure VPN, I must on each computer install special software for access my VPN network. And I don't think that after device got disconnect and get new IP - VPN network is restored quickly.

I want to get easy direct ssh connection to my device on any computer without other special software. Something like TeamViewer or AirDroid works, but with ssh protocol.
Old 04-06-2016, 01:32 PM   #4
LQ Newbie
Registered: Jun 2009
Posts: 14

Original Poster
Rep: Reputation: 0
I have found Mosh alternative to SSH protocol:
Mosh is a replacement for SSH. It's more robust and responsive, especially over Wi-Fi, cellular, and long-distance links.
Mosh automatically roams as you move between Internet connections. Use Wi-Fi on the train, Ethernet in a hotel, and LTE on a beach: you'll stay logged in. Most network programs lose their connections after roaming, including SSH and Web apps like Gmail. Mosh is different.
But the problem is same - I can't get direct TCP connection from computer to device on cellular network, but if I use SSH tunnel for direct access, I lost connection for long time after each reconnect event.

I want to find some SSH Tunnel alternative that works normally on unstable connection and dynamic IP, and don't loss session (or quickly restore it) after changing device ip.

Last edited by Murz; 04-06-2016 at 01:34 PM.
Old 04-06-2016, 01:46 PM   #5
LQ Newbie
Registered: Jun 2009
Posts: 14

Original Poster
Rep: Reputation: 0
Also I found that WebSocket protocol provide stable bidirectional channel on unstable network, maybe we can use web sockets for organize something like SSH Tunnel?


ssh tunnel

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Connection to MySQL through SSH tunnel XDimensioN Linux - Server 2 09-27-2015 11:02 PM
[SOLVED] ssh server on dynamic IP address fscibilia Linux - Networking 1 09-28-2012 03:32 PM
Reverse SSH tunnel connection problem orwb Linux - Server 6 12-01-2010 03:16 PM
how can i tunnel all network with ssh connection ? jabka Linux - Security 2 07-06-2007 03:08 PM
Ssh tunnel : cannot assign requested address sieker Linux - Networking 6 11-11-2005 01:10 PM > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 06:10 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration