iot - 如何从外部网络访问在双 NAT 网络中运行的 webserver
问题描述
这不是编程问题,更可能是网络问题。对不起,如果我不应该在这里发布这个问题。
我正在尝试使用我的公共 IP 从外部网络访问控制我的微控制器 GPIO 的 Web 服务,但我无法访问。经过少量研究,我知道我的 ISP 正在使用双 NAT,并且无法从外部网络访问。但是Blynk
我手机上的应用程序能够从外部网络触发我的微控制器(通过在Blynk
云中注册我的微控制器)。
我的问题是如何Blynk
能够接触到在同一个双 NAT 网络后面运行的设备。
提前致谢。
解决方案
Your difficulty is in having a server initiate a connection to your device when the device is behind double NAT. The Blynk library, which you install on your device, initiates the connection outwards to a Blynk server, which is not behind any NAT. Much the same as your device can initiate an HTTP request for a website and receive a response
Once that connection between device and server is established, traffic is exchanged over that.
To do something similar you essentially want to reverse your thinking of the client/server roles. When you say you’re trying to “access the webserver [on your microcontroller]”; you’re treating your microcontroller as the server. Your microcontroller should be the initiator of the connection (usually the client role).
You can have the device initiate a socket connection to a socket server (which is what blynk is doing) or have it initiate a VPN connection (you can then use the VPN tunnel to treat the device and server as if there is no NAT)
推荐阅读
- kubernetes - Kubernetes 服务集群 ip 不可访问,但端点 ip 可从节点内访问
- javascript - 在谷歌地图上设置 lat 和 lng 变量的问题
- php - 如何在PHP中将循环数组放入数组存储数据
- go - 如何判断两个证书对是由 Golang 中的不同 CA 颁发的?
- android - 在 recyclerView 中使用滑动触摸侦听器时,指定为非 null 的错误参数为 null - Android
- c++ - 在游戏对象的组件等情况下使用组合或虚拟继承
- mysql - 如果实体与不同的实体相关联,我想防止删除该实体
- sql - 有没有办法在输出列中的特殊字符之间使用子字符串在选择查询中获取输出
- angular - 如何在 Angular 中将此 JS 代码转换为现代 TypeScript?
- python - 什么在 Python 中准确定义了一个函数