Raspberry Pi - 从外部网站/Python应用程序访问远程IP地址

发布于 2025-01-09 04:09:56 字数 501 浏览 1 评论 0原文

我有一个应用程序在 Raspberry Pi 3b+ 上运行,内部 IP 地址为 http://192.168.1.8/app/< /a> http://192.168.1.8:8080/app/

我希望能够访问此来自 Heroku 上远程托管的 python 脚本。

目前,我的脚本在我的笔记本电脑上本地运行,但仅当我在同一内部网络上时才有效。我想让 python 脚本远程运行,这样我就可以远离 Pi,它仍然可以运行。

我运行了所有常用的 WhatsmyIP.com 工具,并拥有远程 IP,但它是我的路由器的外部 IP,而不是 Pi。

有人对我如何完成这项工作有任何建议吗?

提前感谢您提供的任何建议。

一切顺利, 西蒙

I have an app running on my Raspberry Pi 3b+ on an internal IP address of http://192.168.1.8/app/
http://192.168.1.8:8080/app/

I would like to be able to access this from a remotely hosted python script on Heroku.

Currently I have the script running locally on my laptop, but only works when Im on the same internal network. I would like to have the python script running remotely so I can be away from the Pi and it still runs.

I ran all the usual whatsmyIP.com tools, and have the remote IP, but its the external IP of my router, not the Pi.

Does anyone have any suggestions of how I could make this work?

Thanking you in advance of any advice you can provide.

All the best,
Simon

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

失眠症患者 2025-01-16 04:09:56

您应该查看端口转发。您转发哪个端口取决于 RPi 和应用程序的设置。所有路由器的启用端口转发都不同,但您通常可以通过在计算机上导航到 192.168.0.1192.168.0.0 来访问路由器设置。
这样做可以让您的 Pi 直接连接到外部互联网。

您还应该考虑到您的公共 IP 很容易发生变化。这是因为互联网提供商通常使用动态 IP 地址而不是静态 IP 地址。有些人在专门要求时会提供它们,通常您必须每月支付一小笔费用。因此,您应该包含一个脚本,让您的树莓派向您更新任何公共 IP 更改,或者使用 DDNS 服务提供商。

You should look at Port Forwarding. Which port you forward depends on the settings of your RPi and your application. Enabling port forwarding is different for all routers, but you can normally access the routersettings by navigating to 192.168.0.1 or 192.168.0.0 on your computer.
Doing so allows a connection directly from your Pi to the outworld internet.

You should also take into account that your public IP is prone to change. That's because Internet Providers typically use dynamic IP addresses rather than static IP addresses. Some do provide them when specifically asking for one, often you have to pay a small monthly fee. You should therefore include a script where your raspberry pi updates you about any public IP changes, or use a DDNS service provider.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文