This is my scenario,

We have some sensors on different sites, these sensors are connected with some equipment having SIM cards in it to allow the internet connection. On the other hand, we have a Linux based server where we are running some applications to request new data from those sensors by socket programming using the IP address of those SIM cards. Recently we have connected the raspberry pi (with ip camera) to record the videos/images locally on the pi's SD card. Currently Raspberry pi is connected with the equipment over the WiFi and it uses SIM data for internet connection.

Now in case of an event we want to upload some images from the pi to the ftp server.

The problem is Pi does not know when the event occurred, only the web application decides when the event has occurred (which is running on the server). Raspberry Pi is only using the internet, it does not communicate with the sensor at all.

I have to write some script on the server which will go to the pi and upload some files from the pi to the ftp server.

Someone suggested that I could use scp, but how do I get to the raspberry pi? I only have the IP address of the SIM card... and when I connect the raspberry pi with SIM, it assigns a private IP which the server cannot see.

Can I connect Raspberry pi with the router in such a way that I can access the pi with the same IP address (of the SIM card) but on different port.... This is how I connected the IP camera...

Any help is appreciated.

  • which device runs the mobile network with the sim? you may get assigned a dynamic ip from the sim's mobile operator. therefor you may need to run a dynamic dns service on this device
    – Gotschi
    Apr 24, 2014 at 12:15
  • This is not an issue... we already have dynDNS in place... The issue is, how do I access the raspberry pi... when I connect raspberry pi with the SIM card (off course using a router) it assigns a private IP address to the pi...
    – Ana
    Apr 24, 2014 at 12:41

1 Answer 1


First of all you need to set the router for port forwarding.

Assign a static IP address to your Raspberry Pi for Example

In the configuration of your router, set the port forwarding parameters (IP address of the raspberry Pi and a range of ports, for instance port 81) so any traffic coming on port 81 will be redirected to the Raspberry Pi.

Now, if you want to upload images from raspberry Pi you will have to use SCP (secure copy). You can find some examples here

I hope this will help.

  • 1
    note: map the external port 81 to port 22 internal to the pi
    – Gotschi
    Apr 24, 2014 at 14:37
  • Port Forwarding it is... This is what I was looking for.. I managed to do it with port forwarding...Thanks for your help. I have to fetch the images using a Java Web Application so I will be using [jcraft.com/jsch/] Thank you very much...
    – Ana
    Apr 25, 2014 at 8:08
  • This is the best example I found to execute shell scripts on linux remotely from java.. journaldev.com/246/…
    – Ana
    Apr 25, 2014 at 9:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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