I build a vending machine, which will be behind different Wifi networks in malls. I cannot influence any configuration of the wifi network. For the regular usage the vending machine uses the internet via wifi.


  1. I want to be able to access the machine from the outside with an ssh connection, to maintain it, for continuous deployment, see logs from uncaught exceptions, etc.
  2. I want to be able to send commands (via sms/or ssh/or browser..) to the machine. E.g sendCurrentLogs, to trigger a function which sends logs (via wifi: for cost reasons).

How I plan to do it

I want to buy a "3g breakout board" and use a dyn dns provider to communicate to the machine. So I should be able to have a fixed IP I can use for the ssh access. Obviously I want a fast connection to transfer files.

For everyday transfers like logs I will use cronjobs.



  1. I need a fast connection but the vendor page says: basic functionality working but it will be a while until we get full GPRS TCP/IP and HTTP support, so can I reach my goal with this module?
  2. How am I able to tell the raspberry which internet connection it should use?
  3. I'm glad for any good tutorial/ressource on this topic, you can recommend
  4. Is there a better method to achieve the above goals. I thought about polling for sending commands but this still leaves the ssh issue. There are some services for managing IOT devices like

But I'm not so sure if/how they bypass the wifi settings.

Aditional Ressources

https://learn.adafruit.com/fona-tethering-to-raspberry-pi-or-beaglebone-black/setup https://www.youtube.com/watch?v=NArpvpmmpUU


I had to do something similiar for a project, where either restricted Wlan or a 3G Stick was used to connect to the internet. The magic to connect in such networks is that connections to the pi are impossible to establish, because of the NAT network, but rather make the Pi connect a server.

I went with a HTTP Server and the Pi polling it every 5 minutes for new instructions to run. You should use TLS to encrypt the sensitive data stream. Should the Pi get an instruction it runs it and sends the result back to me via a POST, but uploading it to an SFTP would work too.

The second method is setting up a VPN server and make all your Pis connect to it when you're connected too you can easily SSH into the Pi.


Setup a VPN where every Pi connects to or use a HTTP site that the Pi periodicly GETs with instructions should you want to run something.


If my understanding is correct, you want to access RPi connected to the Internet through 3G connection.
Since most of the mobile networks don't provide external IP (you're behind NAT) this will be rather impossible without a 3rd party server. You would have to configure some kind of VPN or have the RPi connect directly to your server/computer with external IP and static domain.

  • Maybe I need to clarify this. The Pi is connected to a wifi network (which I can not configurate) e.g. in a mall. So it can make outgoing connections, but there is a high probability, that the firewall of the router there blocks certain ports, ingoing connections etc. My plan is to either use some software which does a smart thing to go around this restriction, e.g. the pi polls some middle server and just gets responses to his own requests (I think that is how weaved works). Or to set up a 3G to be more free with the configuration. If I can avoid additonal hardware it would be better. – Andi Giga Apr 22 '16 at 7:52
  • There are definitely malls that either offer no wifi, or no public wifi. Unless you can rely on your sales team to put wifi network access into the lease contract for your product, you shouldn't assume wifi connectivity. – ObscureRobot Apr 22 '16 at 8:17

Why don't you use 3G dongles ? If Linux drivers exist for your device , it will be faster (no serial protocol overhead) and much easier since the full TCP/IP stack "just works".

enter image description here

You will need a way to get around NAT , be it OpenVPN , reverse SSH tunneling , ngrok , Weaved , Azure etc. - you will need an extra server !


Remot3.it is probably the best service to achieve what you require. Install it on Raspberry Pi and you can access it via SSH from anywhere with internet.


Maybe it is worth to use Teamviewer (or something similar). It'll allow you to avoid using dyn dns service.


Realvnc offers free cloud remote access up to five pcs. I recently used this to access my online camera on the raspbian. Realvnc


https://tunnelin.com is the best service to achieve your goals. It can securely expose your SSH service and you can access it via SSH from anywhere over the internet. Also, you can in real-time monitor your devices and run commands on your devices remotely.


SSH to your Raspberry Pi behind a 3G USB stick modem http://www.thirdway.ch/En/projects/raspberry_pi_3g/index.php

  • Please add the relevant details from the link instead of just posting the link itself. – PNDA Aug 4 '17 at 8:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.