需要UDP端口转发吗? [英] UDP port forwarding required?

查看:68
本文介绍了需要UDP端口转发吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对不起,因为这个愚蠢的问题,但我没有找到答案.所以对于 TCP,只有服务器需要端口转发,而客户端不需要.但是由于 UDP 在技术上没有区分客户端和服务器,我是否也必须为客户端转发端口?(AFAIK TCP 一旦连接到服务器就会自己做)

Sorry because of this dumb question but I didn't quite find an answer. So for TCP only the server needs a port forwarding, but not the client. But since UDP doesn't technically differentiates between client and server, do I have to port forward for the client too? (AFAIK TCP does it itself as soon as it connects to the server)

推荐答案

如果客户端位于 NAT 防火墙后面,那么是的,您将需要一个客户端端口转发.许多 NAT 路由器支持自动"UDP 转发,即在看到传出数据包(客户端正在向服务器发送数据)时自动设置一个临时端口转发,以便回复数据包可以通过回到客户端.您可能需要配置您的路由器以启用此功能,并且可能需要设置各种超时参数以使其正常工作(因为 UDP 没有任何内置于协议中的超时).

If the client is behind a NAT firewall, then yes, you will need a client port forward. Many NAT routers support "automatic" UDP forwarding, that automatically sets up a temporary port forwarding whenever it sees an outgoing packet (the client is sending data to the server), so that the reply packets can make it back to the client. You may need to configure your router to enable this, and may need to set various timeout parameters to make it work properly (since UDP does not have any timeouts built into the protocol).

请注意,TCP 也需要这种反向端口转发,但所有 NAT 路由器/防火墙都会自动执行此操作,因为没有它它们将毫无用处.

Note that this kind of reverse port forwarding is ALSO needed for TCP, but all NAT router/firewalls do that automatically, as they would be useless without it.

这篇关于需要UDP端口转发吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆