2

I have been developing projects with Raspberry Pi 4. For the current project I am running a NextCloudPi server on it. I am able to access the server using my Internal IP. I want to access it using a public domain name or in other words through open Internet. My ISP does not allow port forwarding and static IP.

I tried Zerotier, which creates a VPN and I can access the CloudServer through the static IP assigned under VPN but the transfer speeds are really slow. Another issue is that I need to install it on all the devices through which I am going to access the CloudServer and ofcourse on the RPi4 itself.

Is there any other option that you guys probably have to access RPi4(Basically IOT devices) through Internet? Any suggestion would be greatly appreciated.

ip addr output

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever

2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 link/ether dc:a6:32:6a:82:e4 brd ff:ff:ff:ff:ff:ff inet 192.168.1.35/24 brd 192.168.1.255 scope global dynamic noprefixroute eth0 valid_lft 85963sec preferred_lft 75163sec inet6 fe80::f6e0:36ba:532f:10e9/64 scope link valid_lft forever preferred_lft forever

3: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000 link/ether dc:a6:32:6a:82:e5 brd ff:ff:ff:ff:ff:ff

14
  • have you tried port forwarding on your internet router? Not sure how an ISP can stop you from port forwarding ... I guess your ISP could stop incoming connections of course - but they can't stop port forwarding Jan 17, 2021 at 3:26
  • Maybe Dataplicity? The Pi connects to the server, not the other way around so it works behind firewalls. Jan 17, 2021 at 3:42
  • @JaromandaX , I tried port forwarding on my router but could not find any setting like that. The router is DBC XPON and has really bad web interface and it has a fiber connection. Really not sure how to port forward my router so was searching for other way around. Jan 17, 2021 at 12:03
  • @Unsigned_Arduino I tried Dataplicity using the instructions provided oon their website. I am able to acces the default Dataplicity server nginx but not able to access NextCloudPi's apache server. Not sure why, any inputs? Jan 17, 2021 at 13:21
  • Is it running in port 80, and nothing else is using it? Jan 17, 2021 at 14:42

2 Answers 2

2

I have finally resolved the issue. I have used ngork to create virtual tunnel. I tried to use ngork earlier but was unable as I was running the service on port 80. When I ran the nrogk http service on port 443, I was able to access the NextCloud server using the domain name shown on the ssh terminal. NextCloud uses port 80 for http and 443 for https. I am really not sure why I was not able to access the NextCloud on port 80. This may help if someone is stuck in the similar problem. The problem with ngork is, once the raspberry pi is restarted you will have to restart the ngork service as well and of course the domain address will also be changed. Though my use case don't have any problem with it.

1
  • Yes. Ngrok creates an ephemeral public endpoints for the tcp or http tunnels created. It is temporary and changes every time your device reboots. SocketXP always creates a permanent public endpoints for your web service and it never changes. Also SocketXP can be run as a Linux systemd daemon in the background and automatically starts on reboot. Aug 7, 2023 at 5:43
2

**Full disclosure: I am the founder of SocketXP.

If you want to remotely access your Raspberry Pi behind NAT firewall from anywhere, you can use SocketXP IoT Remote Access solution. You can SSH,VNC or RDP into your Raspberry Pi remotely over the internet. SocketXP also provides a public web-url to remotely access the web service running in your private Raspberry Pi device. It is free to use.

SocketXP IoT Remote Access Solution

Follow the instructions below to setup remote access to your Raspberry Pi via SSH.

Step#1: Download and Install:SocketXP IoT Agent

Download and install SocketXP IoT agent on your IoT or Raspberry Pi device.

Step#2: Login

Sign up here to get your AuthToken. SocketXP has a free plan to try without any strings attached.

Get your authtoken and register your device using the following command:

$ socketxp login <your-authtoken-goes-here>

Step#3: Connect and Access

Next connect your Raspberry Pi or IoT Device to SocketXP Cloud Gateway.

$ socketxp connect tcp://127.0.0.1:22

Connected to SocketXP Cloud Gateway.
Access the TCP service securely using the SocketXP agent in IoT Slave Mode.

Now go to SocketXP web portal, go to the devices section, click the terminal icon next to your device, use your SSH login password to SSH into your device.

Public Web URL for any web service

For example, to remotely access a web service (like NextCloudPi) running on your localhost network (say, port 8080) over the internet, execute the below command. The command creates a secure HTTP tunnel to your localhost web service.

$ socketxp connect http://localhost:8080

Connected to SocketXP Cloud Gateway.
Public URL -> https://test-user-a29dfe42e3.socketxp.com

After you have successfully created the HTTP tunnel, use the public URL provided by SocketXP ( https://test-user-a29dfe42e3.socketxp.com ) to access your localhost web service (like NextCloudPi) from anywhere in the world.

You can also SSH connect to your Raspberry Pi using PuTTY or Filezilla as explained below.

Step #4: SSH access to Raspberry Pi using PuTTY or Filezilla

Download and install SocketXP agent on your laptop or PC(windows/mac/linux).

$ socketxp.exe connect tcp://localhost:3000 --iot-slave --peer-device-id <device-id> --peer-device-port 22 --authtoken <auth token>

Listening for TCP connections at:
Local URL -> tcp://localhost:3000
Accessing the IoT device from your laptop

Now open up PuTTY and connect to "localhost" and port "3000". When prompted provide your SSH login/password. You'll be placed in your Raspberry Pi Shell Prompt.

You can find more instructions on how to setup remote access to your Raspberry Pi behind NAT router or Firewall over the internet using SocketXP here.

1
  • Looks interesting. Will give it a try. Sep 28, 2021 at 11:05

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.