关于网络地址转换(NAT)? [英] About Network Address Translation (NAT)?

查看:92
本文介绍了关于网络地址转换(NAT)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

只是对NAT的特定情况感到好奇.假设我们有4台计算机在NAT下共享一个全局IP地址.我知道NAT框保留了一个内部记录,以知道将请求转发到哪台计算机.但是,假设在2号计算机上,我正在尝试下载文件.假设在1号,3号和4号计算机上,我只是正常浏览网络.当浏览器启动TCP连接以获取该文件时,它如何知道将文件分配给哪台计算机?我的意思是,四台计算机中的每台计算机都使用端口80来浏览网页,对吗? NAT的记录如何区分哪个端口80"属于哪台计算机?

解决方案

"http的端口80"的概念不起作用.当计算机浏览Web时,只有服务器使用端口80,而客户端将使用随机端口号.服务器回复客户端提供的目标端口.端口80仅用于敲击Web服务器的门.

NAT所做的是将所有这4台计算机的外发数据包进行转换,以使它们的源端口不重复. NAT收到数据包后,它将检查是否可以转换连接的目标端口,并在可能的情况下将其转换为LAN.

Just curious about a particular scenario of NAT. Let's suppose we have 4 computers sharing a global IP address under the NAT. I understand that the NAT box keeps an internal record to know which computer to forward requests to. But let's say on computer #2 I'm trying to download a file. And let's say on computer #1, #3, and #4, I'm just browsing the web normally. When the browser initiates a TCP connection to get that file, how does it know which computer to give it to? I mean like, each of the four computers is using port 80 to browse the web right? How does the NAT's record distinguish which "port 80" belongs to which computer?

解决方案

The concept of "port 80 for http" does not work like these. When a computer browse the web, only the server uses port 80, while the client will use a random port number. The server replies with a destination port, provided by the client, attached. Port 80 is just for knocking the web server's door.

What the NAT does do is translating all those 4 computers outward packets such that their source ports does not duplicate. When the NAT receives a packet, it will check if the attached destination port can be translated and translate it to the LAN if possible.

这篇关于关于网络地址转换(NAT)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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