LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 12-22-2016, 06:24 PM   #1
morfeus80
Member
 
Registered: Mar 2006
Distribution: OpenSUSE 10.3
Posts: 53

Rep: Reputation: 15
ssh with 4G dongle


Dear all,

I would like to access to the ssh of my device (Raspberry) that is connected in internet with a 4G dongle modem. The problem is that my ISP gives me a private IP, so I am not able to ping the device.
I read that a VPN should solve the problem and cloud services exist with this purpose.
Can you indicate me a cloud service works fine for my needs? Free would be better...

Thanks
 
Old 12-23-2016, 12:18 AM   #2
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,800

Rep: Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140
One solution is to use a reverse remote SSH tunnel, where the device is configured to phone home...

https://www.tunnelsup.com/raspberry-...te-ssh-tunnel/
 
Old 12-23-2016, 01:18 AM   #3
morfeus80
Member
 
Registered: Mar 2006
Distribution: OpenSUSE 10.3
Posts: 53

Original Poster
Rep: Reputation: 15
Hi Ferrari, the problem to do this is that I need a server with a static IP that I don't have...
 
Old 12-23-2016, 01:37 AM   #4
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,800

Rep: Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140
Well, you could use DynDNS (or similar) so that your remote device can always find your server by hostname.
 
Old 12-23-2016, 01:50 AM   #5
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,800

Rep: Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140
To expand on using dynamic DNS, here's two guides which may be of help to you

https://wiki.archlinux.org/index.php/Dynamic_DNS
https://help.ubuntu.com/community/DynamicDNS

Check out the free options listed.
 
Old 12-23-2016, 02:06 AM   #6
morfeus80
Member
 
Registered: Mar 2006
Distribution: OpenSUSE 10.3
Posts: 53

Original Poster
Rep: Reputation: 15
Maybe I was not clear, the problem is that I don't have any server that can always be running.
For my connection I can only use 1 laptop with Windows and 1 Raspberry with Linux and they both are connected to internet with a private IP, so they can't reach each other...
 
Old 12-23-2016, 02:18 AM   #7
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,307
Blog Entries: 3

Rep: Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721
Quote:
Originally Posted by morfeus80 View Post
Maybe I was not clear, the problem is that I don't have any server that can always be running.
For my connection I can only use 1 laptop with Windows and 1 Raspberry with Linux and they both are connected to internet with a private IP, so they can't reach each other...
If you don't have an external server always running, such as a renting VPS, you can run SSH as an onion service. It's not hard but runs slowly so it's only good for small transfers or for logging in and establishing a reverse tunnel to an externally visible machine (which you don't have).

If you go that route, consider contributing in some way to the project, even a small way, so their network does not get overburdened. Also, be sure to keep the onion SSH service separate from any other SSH service you may have on that host. That's not just a principle to follow but also contributes to the value of the Tor network. Both ways invest in the network and increase it's value.
 
Old 12-23-2016, 02:27 AM   #8
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,800

Rep: Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140
Quote:
Maybe I was not clear, the problem is that I don't have any server that can always be running.
You don't need to have the server always running. The remote R.Pi will keep attempting to connect (via cron job for example) until it can reach your server (when it is online). Then you can access it as described in the page I linked to in my first reply.

Quote:
For my connection I can only use 1 laptop with Windows and 1 Raspberry with Linux and they both are connected to internet with a private IP, so they can't reach each other...
That's not true. You will need port forwarding set up on the router connecting your windows machine but that is all. As long as the R.Pi can find the public IP address (using dynamic DNS) then all should be good.

Last edited by ferrari; 12-23-2016 at 02:31 AM.
 
Old 12-23-2016, 03:42 AM   #9
morfeus80
Member
 
Registered: Mar 2006
Distribution: OpenSUSE 10.3
Posts: 53

Original Poster
Rep: Reputation: 15
Ferrari,

maybe you don't have clear that when you connect with a GSM dongle, most pos the ISP providers of the world put you behind a NAT to limit the number of public IP they have to use and there is no way to port forwarding, because the "router" is their server and obviously customers can't configure it...
 
Old 12-23-2016, 03:58 AM   #10
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,800

Rep: Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140
No, it is you that doesn't understand. I have a remote device connected via 3G that I can connect in a similar fashion using PPTP VPN. The remote Mikrotik router has a VPN client and connects to my local server. This allows me to reach it. NAT is in use both ends in fact. The same principle is at play for the reverse remote SSH tunnel. You clearly haven't even taken the time to read the article I linked to. (It does not require knowing the shared public IP for the mobile broadband device at all in order to work.) Routing allows the remote device to reach the internet and establish the tunnel in the first place. It does rely on the server router having port forwarding configured of course. Many people use similar approaches to get connectivity to remote devices via the internet.

Last edited by ferrari; 12-23-2016 at 04:02 AM.
 
Old 12-23-2016, 04:03 AM   #11
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,307
Blog Entries: 3

Rep: Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721
@ferrari some of the mobile modems can go through over a half-dozen layers of NAT before getting an external IPv4 address. In such cases, it's not possible to forward ports. The only two options in those cases are reverse tunnel to an externally accessible box somewhere or setting up an onion service. Probably due to failure to invest in their own infrastructure the ISPs lack IPv6 which would solve several problems for them including the number of available external addresses.

Last edited by Turbocapitalist; 12-23-2016 at 04:07 AM. Reason: ISP
 
Old 12-23-2016, 04:03 AM   #12
morfeus80
Member
 
Registered: Mar 2006
Distribution: OpenSUSE 10.3
Posts: 53

Original Poster
Rep: Reputation: 15
Again... I don't have any server to make the VPN. As I asked in the first post of this topic, I would like to know if any service of cloud VPN exists and allows me to do the tunnel...
 
Old 12-23-2016, 04:08 AM   #13
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,800

Rep: Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140
Topology looks like this...

R.Pi with 4G dongle ----- Internet ----- <Public IP address> Router with port forwarding <LAN> ----- Local server
 
Old 12-23-2016, 04:09 AM   #14
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,800

Rep: Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140
Quote:
Again... I don't have any server to make the VPN. As I asked in the first post of this topic, I would like to know if any service of cloud VPN exists and allows me to do the tunnel...
You don't use a VPN. It's all done using SSH! Read the article please!
 
Old 12-23-2016, 04:14 AM   #15
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,800

Rep: Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140
Quote:
@ferrari some of the mobile modems can go through over a half-dozen layers of NAT before getting an external IPv4 address. In such cases, it's not possible to forward ports.
@Turbocapitalist. No port forwarding is used with respect to the mobile broadband network. Only at the local router. See the network topology I've posted.

Quote:
The only two options in those cases are reverse tunnel to an externally accessible box somewhere or...
Yes! That is what I'm suggesting

I use a similar approach to get access to a remote network using VPN, but could just have easily implemented it using SSH.

Last edited by ferrari; 12-23-2016 at 04:16 AM.
 
  


Reply



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
3g dongle connected via ppp daemon unable to send AT commnads to the dongle jarzi Linux - Networking 4 08-07-2015 04:45 AM
how to connect to internet via usb dongle (MPS internet dongle) on Fedora 16 O.S danibhai Linux - Newbie 1 07-30-2012 11:03 AM
ssh-agent, ssh-add and ssh-keygen AND CVS raylpc Linux - General 2 11-19-2008 02:50 AM
bt Dongle cybil001 Linux - General 3 02-12-2007 10:00 AM
Passwordless SSH with SSH commercial server and open ssh cereal83 Linux - General 7 04-18-2006 12:34 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 03:12 AM.

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