穿过防火墙的点对点网络连接

发布于 2025-01-04 04:05:08 字数 298 浏览 3 评论 0原文

我想在不同位置的两台计算机之间设置网络连接(RTP 或 UDP),每台计算机都位于 NAT 调制解调器/防火墙后面。我不想对防火墙进行任何修改。

我的工作假设是我需要一个两台计算机都可以访问的机器人(例如互联网服务器上的 shell 帐户)。每台计算机都连接到机器人,机器人允许两台计算机更新和查询状态以及交换数据。

就目前而言这还可以,但这意味着所有数据都通过机器人传输。有没有一种方法可以在没有机器人的情况下连接两台计算机,或者如果失败,允许机器人在连接建立后退出数据交换?我的感觉是没有办法做到这一点,但是我的TCP/IP有点生锈了......

I would like to setup a network connection (RTP or UDP) between two computers at different locations, each of which is behind a NAT modem/firewall. I do not want any modification of the firewalls.

My working assumption is that I need a bot somewhere that both computers can reach (eg a shell account on an internet server). Each computer connects out to the bot and the bot allows the two computers to update and query status and to exchange data.

This is ok as far as it goes, but it means that all data travels via the bot. Is there a way I can connect the two computers without the bot, or failing that, allow the bot to drop out of the data exchange once a connection has been setup? My feeling is that there is no way to do this, but my TCP/IP is a bit rusty...

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

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

发布评论

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

评论(1

胡渣熟男 2025-01-11 04:05:08

如果您对 NAT/防火墙没有任何假设,那么您是正确的。

例如,据我所知,打洞不适用于过载的 NAT (PAT),因为源端口是由 NAT 设备随机化的,并且它映射/匹配目标公共地址和所选的所选源端口。

UPnP 可能可以工作,但您需要再次假设它存在并在 NAT 设备上启用。

在我看来,如果你想通用,你只有两个选择:
1. 配置NAT。
2.使用代理(您提到的机器人)。
例如,Skype 使用第二种方式,但通过使用每个 Skype 客户端作为潜在代理以分布式方式进行(可能仅当它检测到它不在 NAT 后面或不受 NAT 限制时)。

If you assume nothing on the NAT/Firewall your are correct.

Hole-Punching for example will not work with overloaded NAT (PAT) as far as I know, because the source port is randomized by the NAT device, and it maps/match both the destination public address and the picked up source port elected.

UPnP may work, but again you need to assume it exist and enabled on the NAT device.

As I see it, you got only two options if you want to be generic:
1. Configure the NAT.
2. Use a proxy (the bot you mentioned).
Skype for example uses the second, but does it in a distributed manner by using every Skype client as a potential proxy (probably only if it detects it is not behind a NAT or not limited by it).

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