Individual machines use ports to send data to the program or service that needs that data.
各个机器使用端口将数据发送到需要该数据的程序或服务。
观看视频后,了解更多关于端口的TCP/IP指南:
TCP/IP传输层协议(TCP和UDP)寻址:端口和套接字
TCP/IP进程、多路复用和客户机/服务器应用程序角色
TCP/IP端口:传输层(TCP/UDP)寻址
TCP/IP应用程序分配和服务器端口号范围:已知、注册和动态/私有端口
TCP/IP客户端(临时)端口和客户端/服务器应用程序端口的使用
TCP/IP套接字和套接字对:进程和连接标识
常见的TCP/IP应用程序,并分配众所周知的和注册的端口号
>>The way network communication goes in and out of a machine, physically,is through the NIC, Network Interface Card.
在物理上,网络通信进出机器的方式是通过网卡,即网络接口卡。
The way network communication goes inand out of a machine logically though, is through a program or service.
但是,网络通信在逻辑上是通过程序或服务进出机器的。
A service is a program that runs in the background independent of the logonthat provides functionalities to a system.
服务是独立于为系统提供功能的登录而在后台运行的程序。
Windows client machines for instance, will have a workstation service running in the backgroundthat allows for connections to remote network resources.
例如,Windows客户机将在后台运行工作站服务,允许连接到远程网络资源。
It's not tied to a single user logon and is always running in the background.
它不受单个用户登录的限制,总是在后台运行。
When you start a web server, you're starting a specific server service that isn't tiedto a specific user logon, either.
当您启动web服务器时,您也启动了一个与特定用户登录无关的特定服务器服务。
This way, when the server reboots, the service automatically starts before anyone logs on.
这样,当服务器重新启动时,服务会在任何人登录之前自动启动。
In the world of Linux services are known as daemons.
在Linux世界中,服务被称为守护进程。
Well, how does network communication go in and out of a program or service?
那么,网络通信是如何进出程序或服务的呢?
Let's say a single machine is running both an FTP,File Transfer Protocol server as well as a web server.
假设一台机器同时运行FTP、文件传输协议服务器和web服务器。
If they both are accessible by the same IP address, how does the trafficfor the FTP server get to the FTP server and the trafficfor the web server get to the web server?
如果它们都可以通过相同的IP地址访问,那么FTP服务器的流量如何到达FTP服务器,web服务器的流量如何到达web服务器?
Think about an apartment building with a mailbox grid in the lobby.
想象一个公寓大楼,大厅里有一个邮箱网格。
The man in apartment 21 checks his mail with a key to box 21 and the womanin apartment 80 check her mail with a key to box 80.
21号公寓的男人用21号盒子的钥匙查看邮件,80号公寓的女人用80号盒子的钥匙查看邮件。
The mailman brought their mail to the same building.
邮递员把他们的邮件送到了同一座大楼。
They both live in the same building with the same street address.
他们俩住在同一幢楼里,街道地址相同。
This is like two different servers that are accessible through the same IP address,however when traffic is destined for the man in apartment 21,it is noted on the front of the envelope.
这就像两个不同的服务器,可以通过相同的IP地址访问,但是当流量是为公寓21的人发送的时,它会在信封的前面注明。
And the same goes for the mail addressed to the woman in apartment 80.
寄给80号公寓那位女士的邮件也是如此。
Similarly, the way into and out of a program or service isthrough a port, which is a logical number.
类似地,进出程序或服务的方式是通过端口,端口是一个逻辑数字。
So, in addition to source and destination Mac addresses and sourceand destination IP addresses, there are, in fact, source and destination ports.
因此,除了源和目的Mac地址和源和目的IP地址之外,实际上还有源和目的端口。
Mac addresses are found in frames that layer two of the OSI model.
Mac地址是在OSI模型的第二层的帧中找到的。
IP addresses are found in packets at layer three.
IP地址在第三层的包中找到。
Port numbers are found in either TCP segments or UDP datagrams at layer four.
端口号可以在第4层的TCP段或UDP数据报中找到。
Based on the destination port, the destination machine knowswhich program or service to send the data to.
基于目标端口,目标机器知道将数据发送到哪个程序或服务。
The same way that the mailman knows to put the mailfor apartment 21 in the box for apartment 21.
就像邮递员把21号公寓的邮件放进21号公寓的邮箱一样。
And the mail for apartment 80 in the box for apartment 80.
80号公寓的邮件在80号公寓的邮箱里。
Ports are organized into three categories.
端口被组织成三类。
Well known ports from 0 to 1,023 or used by major protocols and services.
已知端口从0到1,023,或被主要协议和服务使用。
For instance, FTP servers listen on port 21 and web servers listen on port 80.
例如,FTP服务器监听端口21,web服务器监听端口80。
Registered ports from 1,024 to 49,151 are assigned by IANA,the Internet Assigned Numbers Authority, for specific companies that want a common portto be used for their programs or protocols.
注册端口从1024到49151由IANA(互联网指定号码管理局)分配给特定的公司,这些公司希望为其程序或协议使用一个公共端口。
However, these ports can be used by any system that is currently not in use.
但是,这些端口可以被当前未使用的任何系统使用。
Registered ports are locally significant to a system.
注册端口对系统具有本地重要性。
It's not like using a registered IP address which has global scope.
这与使用具有全局作用域的注册IP地址不同。
Dynamic ports from 49,152 to 65,535 are used by client applications on an as-needed basis.
客户机应用程序根据需要使用49,152到65,535之间的动态端口。
For example, your browser might open up port 60,000 to send the request to a web serverthat will be listening for requests on port 80unencrypted HTTP.
例如,您的浏览器可能会打开端口60,000,将请求发送到web服务器,该服务器将侦听端口80未加密HTTP上的请求。
The web server's response is sourced from port 80 and is destinedfor the port that your browser opened up.
web服务器的响应来自端口80,它的目的地是浏览器打开的端口。
After the communication between your browser and the web server is complete, your browser closesup the port it opened but the web server's port remains open for new, incoming connections.
在您的浏览器和web服务器之间的通信完成之后,您的浏览器将关闭它打开的端口,但是web服务器的端口仍然为新的传入连接保持打开状态。
Your browser will subsequently open up a different port and in that dynamic rangefor traffic to and from the same or a different website.
您的浏览器随后将打开一个不同的端口,并在该动态范围内为来自相同或不同网站的流量打开一个不同的端口。
转载于:https://www.cnblogs.com/sec875/articles/10358028.html