我有一个基于 linux 的设备(假设是一个 Raspberry Pi),它托管一个 HTTP 服务器。此设备会定期更改 WiFi 接入点,并且由于 NAT 和/或防火墙的原因通常无法公开访问。
我想使用公开可用的服务器(rpi.example.com如下)设置反向 ssh 隧道,rpi behind NAT以便rpi.example.com在启动时建立隧道。rpi.example.com然后将任何 HTTP 请求转发到rpi behind NAT.
时序图:
HTTP client rpi.example.com rpi behind NAT
+ + +
| | ssh -R |
| | <-----------------+
| GET /temp | |
+-----------------> | |
| +-----------------> |
| | [SSH tunnel] |
| | <-----------------|
| HTTP/1.1 200 OK | |
| <-----------------+ |
| | |
Run Code Online (Sandbox Code Playgroud)
如何设置这样的反向 …