英文:
Remote access from Desktop to RPI behind an LTE Modem and dynamic IP address
问题
我正在尝试从我的桌面远程连接到我的RPI Zero2W。
以下是当前的环境:
- RPI和桌面位于不同的网络上,RPI连接到LTE调制解调器,桌面连接到路由器。
- LTE调制解调器在启动时会更改IP地址,并且不允许端口转发。
- LTE上唯一已知开放的端口是端口1883(MQTT)和端口8883(MQTTS)-->路由器本身通过MQTT协议提供通信。
由于这些复杂的连接要求,我一直无法远程连接到我的RPI。
互联网上提供了各种解决方案:
- 使用VPN:我尝试过使用WireGuard,但在路由器端口转发方面遇到了问题。为了使端口转发起作用,我需要知道连接到LTE调制解调器的RPI的IP,但由于IP是动态的,因此使用端口转发没有用,它甚至不在同一个网络中。
- 使用第三方应用程序:我尝试过使用Ngrok,但由于它需要端口转发,所以只能打开端口1883和8883,其中端口1883用于与服务器进行MQTT通信。唯一可用的是端口8883,但由于我想使用SSH,我需要使用端口22,而端口8883不适用。
- SSH隧道:同样,由于双方都需要端口转发,我也无法成功实现这一点。
英文:
I am trying to connect remotely to my RPI Zero2W from my desktop.
Here is the current environment
- The RPI and Desktop are on separate networks, the RPI is connected to a LTE Modem and the desktop to a router
- The LTE modem changes the IP address every time on startup and does not allow port forwarding
- The only known ports that are open on the LTE are port 1883 (MQTT) and port 8883 (MQTTS) --> the router itself provides communication with MQTT protocol
Due to these complicated connection requirements I have not been able to connect remotely to my RPI at all.
The internet suggests various solutions:
- Using a VPN: I have tried using wireguard but got stuck on the router port forwarding. In order for the port forwarding to work I would need to know the IP of the RPI connected to a LTE modem, but since the IP is dynamic there is no use using port forwarding, it is not even on the same network.
- Using third party apps: I have tried using Ngrok but since it requires port forwarding I am only able to open ports 1883 and 8883, from which 1883 is used for MQTT communication with the server.
The only one available is port 8883, but since I want to use ssh I need to use port 22 which port 8883 isn't - SSH tunneling: Again since both sides require port forwarding I have not been able to successfully pull this off either
答案1
得分: 1
以下是翻译好的部分:
根据我的理解,一些端口是开放的,这意味着你可以从你的桌面连接到这些端口,只要你知道RPi的IP地址。但是从RPi,我认为你可以连接到其他端口,如443。
我建议使用以下解决方案:
在你的RPi上,运行以下命令 ssh -p 443 -R0:localhost:22 tcp@a.pinggy.io
。这将为你提供一个地址和端口,用于从你的桌面访问RPi。
现在有一个注意事项,在重新启动后,这个地址将会更改。你可以通过以下方式找到地址:
-
在 pinggy.io 上创建一个免费帐户。
-
在你的RPi上使用以下命令(将
yourtoken
替换为你的pinggy令牌):while true; do ssh -p 443 -R0:localhost:22 yourtoken+tcp@a.pinggy.io; sleep 5; done
-
然后从pinggy仪表板中,你可以随时检查你的当前地址和端口。
披露:我是Pinggy团队的一员。
英文:
As per my understanding some ports are open meaning you can connect to those ports from your Desktop provided you know the IP address of the RPi. But from RPi I assume you can connect to other ports such as 443.
I would suggest this solution:
On your Rpi, run this command ssh -p 443 -R0:localhost:22 tcp@a.pinggy.io
. This would give you an address and port using which you can access your RPi from your desktop.
Now there is a catch, on a restart this address will change. You can do this to figure out the address:
-
Create a free account on pinggy.io
-
Use the command on your RPi (replace
yourtoken
with your pinggy token):while true; do ssh -p 443 -R0:localhost:22 yourtoken+tcp@a.pinggy.io; sleep 5; done
-
Then from the pinggy dashboard you can always check your present address and port.
Disclosure: I am a part of Pinggy team
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论