使用P2P程序时端口转发的原理是什么
每次我使用不同的路由器和不同的P2P程序时,我都会遇到同样的问题——端口转发。然后,我通常会读取端口的随机值(TCP、UDP,等等)并将其粘贴到路由器设置页面中的随机位置,然后重复此过程,直到该死的东西开始工作。因为我有点厌倦这样做,所以我想稍微了解一下其背后的理论,以便我可以立即将正确的东西放在正确的位置。有人可以用几句话向我简要解释一下吗?对问题的冗长描述表示歉意,但我不知道如何以更简洁的方式描述我正在谈论的理解水平。
谢谢。
Every time I use a different router and different P2P program, I get the same problem - port forwarding. I then usually read random values of ports(TCP, UDP, whatever) and paste it into random places in my router setttings page and repeat this process until the damn thing starts working. As I am a bit tired of doing that i would like to understand the theory behind it a little bit, so that I can put the right things in right places immediately. Could anybody just explain it briefly to me in a few words? Apologies for lengthy description of the problem, but I didn't know how to describe the level of understanding that I am talking about in a more concise way.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
好吧,路由器将您与外部世界隐藏起来,因此您只能进行传出连接,路由器负责将您的请求发送到外部世界,接收响应并将其发送回给您。除非您明确要求,否则没有人可以向您发送数据包,即您只能接收响应。
在 p2p 上,将数据包发送到您的计算机的能力即使不是至关重要,也是很重要的。因此,您要做的就是要求路由器将所有传入的数据包转发(这里!这就是这个词的来源)到端口 X 到您的计算机端口 X。
Well, the router hides you from the outer world, so you can only make outgoing connections, for which router takes care of sending your requests to the outer world, receiving responses, and sending those back to you. No one can send a packet to you unless you have specifically asked for it—i.e. you can only receive responses.
In case on p2p, the ability to send packets to your machine is important if not vital. So what you do is ask router to forward (here! that's where the word comes from) all incoming packets to port X to your machine, port X.
最初,IP 地址是为每个设备提供的,现在我们往往每个家庭都有 1 个 IP 地址(除非您做了一些疯狂的事情),也称为您的外部 IP。您的外部 IP 是您通过路由器与世界的连接,但网络中的每台计算机都有自己的 IP(称为内部 IP)。端口转发允许外部世界与特定计算机建立通信。
Web 服务器是一个简单的示例,Web 服务通常依赖于端口 80,假设您的网络中有 4 台计算机,其中 1 台是您的 Web 服务器。外界如何知道要联系哪台电脑?端口转发允许您告诉路由器将互联网流量定向到该服务器。
Originally IP addresses were provided per device, now-a-days we tend to have 1 IP address per household (unless your doing something crazy), also called your external IP. Your external IP is your connection to the world via your router, but each computer within your network has it's own IP (called internal IP). Port forwarding allows the external world to establish communications with a specific computer.
A web server is a simple example, web services typically rely on port 80, what-if in your network you had 4 computers, 1 of which was your web server. How would the outside world know which PC to contact? Port Forwarding allows you to tell your router to direct internet traffic to that server.