1

I have a device which is used to monitor analog sensor data(Micron optics sm130 ) with ethernet port available. Its works fine if If I connect it with my laptop using ethernet cable and by configuring my laptop's IP as static 10.0.0.12. I use enlight software to monitor. Now The configuration I want is more likely to be

                                         RPi
    (USB Mobile Internet Dongle )┌──────bridge──────┐   wired  
 laptop <.~.~.~.~.~.~.~.~.~.~.~> │        br0 (eth0)│ <-------> sensor
                                                                 /
                                                           10.0.0.126

I want to monitor it wirelessly i.e. I want to put this device at the site and want to monitor it from any part of world. I am connecting SM135(Device) with raspberry pi and raspberry pi is having internet with help of USB mobile internet dongle. I am asking how to configure raspberry pi to act like a bridge between my laptop and the device and both connected with internet.

P.S : I was able to make device work wirelessly in my private network i.e. I can operate device wirelessly using my laptop within a range as answered in similar question

How to connect a ethernet device(having its own static I.p and netmask) wirelessly by my laptop?

Edit1:- Removed Wlan0 from the diagram.

Edit2:- I was able to screen mirror my raspberry pi to my Laptop using remote.it service using VNC server. I can make raspberry pi a ssh,vnc server or a custom tcp server as suggested in this article https://docs.remote.it/using-the-interactive-installer/add-a-service-to-a-lan-application Is it possible to do this now?

  • No, I do not want wifi to come into the picture. I am having working USB Mobile internet dongle & I want to use that for internet connectivity. Constraints are as such. – bandejiya Feb 19 at 6:48
  • I was interpreting Wlan0 as internet connection may be I should have right ppp0 instead. I hope you have understood my question more clearly – bandejiya Feb 19 at 6:55
  • Now I have removed wlan0 – bandejiya Feb 19 at 8:45
  • 1
    @Milliways both are different in this question there is internet in between device & laptop. in other question everything is happening in a private network – bandejiya Feb 21 at 2:39
1

First you have to setup the 4G dongle to connect to your provider and this way you can get into the internet. You should be able to ping google.com from the RasPi. We cannot help you much with setting up the dongle because it is a specific device and not belonging to Raspberry Pi. If you have done it then you must have an interface representing the internet connection, maybe ppp0 or usb0.

Bridging this interface with eth0 is not advisable for this simple task. Over the internet you can only do it using a virtual private network (VPN) with a tap interface. It is overkill and not worth the effort. So you should just use routing with different subnets for the laptop and for the sensor.

The next problem is that the laptop connects through the web to the 4G dongle and it only sees the public ip address given from the provider of the dongle. This public ip address may be change from time to time usually when you establish a new connection with the RasPi. You can use a dynDNS service so you can use the same DNS name for the changing public ip address. dynDNS will always assign the right ip address to the DNS name. Or you can purchase a static public ip address from your provider.

Another problem is that the 4G dongle (and any other router) uses network address translation (NAT) to connect to the internet. This is the method to translate private ip addresses, e.g. 192.168.0.0/16 to the one public ip address seen from the internet side. So you have to use so called port forwarding to find the way backwards from the one public ip address to your sensor. Maybe it isn't needed with this one to one connection but I don't know it now without details of the configuration. If needed it must be able to configure the dongle with port forwarding.

Update:
You wrote in a comment that you already have access to a Graphical User Interface (GUI) on the RasPi via internet with VNC from the laptop. I assume you have MS Window$ running on the laptop and need to run a program that accesses the sensor by its ip address and on a specific port. This means we have a server running on the sensor serving data to the specific port. We have a TCP connection (ip address and port) that can be routed/redirected/forwarded/bridged/whatever like any other TCP connection.

With a ssh tunnel it is possible to access the port on the remote sensor with port redirection. On a laptop with a Linux operating system it would look something like this, if you want for example to access a secured web server:

laptop ~$ ssh -nNT -L 4433:10.0.0.126:443 public-ip.raspi.dyndns.com &
# In a web browser use this URL
laptop ~$ https://localhost:4433

This will redirect access to port 4433 on the Linux laptop to port 443 on the sensor (10.0.0.126). I don't know how to do it on MS Windows. I know it's possible but out of scope here.

I suggest to setup it in two steps. First build a SSH tunnel. You should establish a Secure SHell so you can login on your remote RasPi. As far as I can see, the tool you are using, can do it. Just select "1) SSH on port 22" instead of "3) VNC on port 5900". You should be able to login to the remote RasPi to a shell with command line. If this is working then it should be no problem to make the SSH tunnel.

Second: setup port redirection. To reduce possible error sources you should do it first on your local network. You already have a direct connection to the sensor as shown at your other question How to connect a ethernet device wirelessly by my laptop?. If you can access the local sensor with the monitoring tool using the ip address 127.0.0.1 or localhost and the port you have specified, then you can make the ssh tunnel and redirect to the remote sensor.

  • Hello Ingo, my raspberry pi is having internet & I am using it using wvdial , the 4G dongle is ppp0 interface. 4g is there & I can ping the device's static ip from raspi i.e. both are connected to raspberry pi. Please suggest how to proceed further. – bandejiya Feb 21 at 0:54
  • @bandejiya Does the dongle is configurable? Does it has a web/ssh/telnet/whatever interface? Can you ping google.com? – Ingo Feb 21 at 1:13
  • Dongle is connected to raspberry pi & from raspberry I am pinging google.com. but I can use remote.it service to make raspberry pi a ssh server using remote.it. Though I was able to screenmirror raspberry pi to my laptop via internet using remote.it vnc service. But only screen was mirrored. I was not able to connect to device from my laptop via internet. – bandejiya Feb 21 at 2:09
  • @bandejiya Ah.. you already have access from the laptop to a GUI Desktop on the RasPi via VNC over internet. With this you should be able to access the sensor, maybe with a terminal window, and show what you want on it, isn't it? Or do you need to transfer data from the sensor to the laptop? – Ingo Feb 21 at 10:34
  • Actually the software which shows the analog data after asking the ip & port can not be installed on raspberry pi as its an executible file. So I think only way was to install it on laptop & anyhow make a TCP connection. But in case of screen mirroring via vnc my laptop is unable to make a tcp connection.. is there something ssh tunneling or ssh reverse tunneling can help..? – bandejiya Feb 21 at 10:52
1

Ahh.. At last I connected to my LAN device from internet or from anywhere without router or by using pi and dongle only. steps are as followed :-

  1. Configure the USB modem.

remember to use :- pi# sudo wvdial instead of pi# wvdial otherwise it will give a error & also change APN to given by network operator. after all this your pi should have internet coming from usb modem.

  1. Give the respberry's eth0 a Compatible static I.P & subnet mask so that raspberry pi is able to connect to the sensor device

  2. Now install remote.it in raspberry pi & configure your personal account.

  3. Now the most trickiest part, Create a proxy connection to your raspberry pi which will attach required device's (sensor) TCP service to your internet(Its ) enter image description here

    5.Now login in your remote.it web portal from anywhere in world & get your proxy address with its port this proxy is between internet & the sensor device. enter image description here enter image description here

So now we are able to connect to any device of our tcp private network from any part of the world by using raspberry pi & dongle only. Here service provided by remote.it is groundbreaking its very innovating.

P.S. : During configuring remote.it in raspberry pi be careful to write correct port.

Update 1 :- system is some sort of as in below picture. enter image description here

  • As far as I understand you do not need the monitoring tool on the MS Windows Laptop? This is managed by remote.it? – Ingo Feb 22 at 12:10
  • Hello @ingo I have updated my answer with a picture. Please have a look, the remote.it is to attach a the LAN application (10.0.0.126:1852) to internet. while the S/W(asks I.P.:Port) on laptop is to visualise the data on laptop – bandejiya Feb 25 at 8:36
  • Thanks for the feedback. remote.it is an interesting service. I will have it in mind. Does my answer help you a bit? Is it worth an upvote? – Ingo Feb 25 at 10:34
  • yeah @ingo! not only your answer but your help is worth of 100s of answer. but still I am trying to achieve what you told as getting a lag in visualising the data. I am trying to give you a upvote but to do that I require 15 reputation(I am a noob :P) so to give you a upvote I need your upvote to gain reputation & than I can vote for you! so upvote my answer please! :D – bandejiya Feb 26 at 2:39
  • Ah.. sorry haven't seen that. +1 – Ingo Feb 26 at 9:47

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.