当前位置:文档之家 > Network Engineering English - Assignment 5-Port Number

Network Engineering English - Assignment 5-Port Number

Port Number


In computer networking, a port is an application-specific or process-specific software construct serving as a communications endpoint. It is used by Transport Layer protocols of the Internet Protocol Suite, such as Transmission Control Protocol (TCP) and User Datagram Protocol (UDP). A specific port is identified by its number, commonly known as the port number, the IP address with which it is associated, and the protocol used for communication.


A well-known range of port numbers is reserved by convention to identify specific service types on hosts. In the client-server model of application architecture this is used to provide a multiplexing service on each port number that network clients connect to for service initiation, after which communication is reestablished on other connection-specific port numbers.

一系列众所周知的端口号因为在主机上确定特定的服务类型而被习俗性的保存起来。应用程序体系结构中的客户-服务器模型用来在每个网络客户端为了服务开始而连接的端口号提供多路复用的服务,之后会话被重新建立在其它特定连接的端口号上。Technical details


Transport Layer protocols, such as the Transmission Control Protocol (TCP), the User Datagram Protocol (UDP), specify a source and destination port number in their packet headers. A port number is a 16-bit unsigned integer, thus ranging from 0 to 65535. A process associates its input or output channel file descriptors (sockets) with a port number and an IP address, a process known as binding, to send and receive data via the network. The operating system's networking software has the task of transmitting outgoing data from all application ports onto the network, and forwarding arriving network packets to a process by matching the packets IP address and port numbers.

传输层协议,诸如传输控制协议(TCP),用户数据报协议(UDP),会在它们的头部指定一个资源和目的地的端口号。端口号是16位的无符号整数,因此从0排列到65535. 进程会与它输入或输出频道文件的描述符(套接口)联系在一个端口号,IP地址,已知的捆绑的进程上,从而通过网络发送和接受数据。操作系统的网络软件有从在网络上的应用程序端口传出数据和通过匹配数据包的IP地址和端口号转发正在到达的数据包到一个进程的任务。Applications implementing common services often use specifically reserved, well-known port numbers for receiving service requests from client hosts. This process is known as listening and involves the receipt of a request on the well-known port and reestablishing one-to-one server-client communications on another private port, so that other clients may also contact the well-known service port. The well-known ports are defined by convention overseen by the Internet Assigned Numbers Authority (IANA), cf. list of TCP and UDP port numbers.



The core network services, such as the World-Wide Web, typically use small port numbers, less than 1024. In many Unix-like operating systems superuser privileges are required for creation of these ports, since these are often deemed critical to the operation of IP networks. Conversely, the client end of a connection typically uses a high port number allocated for short term use, therefore called an ephemeral port.


Port numbers are encoded in the transport protocol packet header, and they can be readily interpreted not only by the sending and receiving computers, but also by other components of the networking infrastructure. In particular, firewalls are commonly configured to differentiate between packets depending on their source or destination port numbers. Port forwarding is an example application of this.

端口号被编码在传输协议数据包的头部,而且它们可以很容易的被解读不仅仅是被发送和接受的计算机,还有其它网络基本设施的组件。特别的是,防火墙一般都被设置在取决于它们资源的数据包之间或目的地端口号之间。端口转发是这类程序的一个例子。Processes create associations with transport protocol ports by means of sockets. A socket is the software structure used as the transport end-point. It is created by the operating system for the process and bound to a socket address which consists of a combination of a port number and an IP address. Sockets may be set to send or receive data in one direction at a time (half duplex) or simultaneously in both directions (full duplex).


Because different services commonly listen on different port numbers, the practice of attempting to connect to a range of ports in sequence on a single computer is commonly known as port scanning. This is usually associated either with malicious cracking attempts or with network administrators looking for possible vulnerabilities to help prevent such attacks.

Port connection attempts are frequently monitored and logged by computers. The technique of port knocking uses a series of port connections (knocks) from a client computer to enable a server connection.




An example for the use of ports is the Internet mail system. A server used for sending and receiving email generally needs two services. The first service is used to transport email to and from other servers. This is accomplished with the Simple Mail Transfer Protocol (SMTP). The SMTP service application usually listens on TCP port 25 for incoming requests. The second service is the Post Office Protocol (POP) which is used by e-mail client applications on user's personal computers to fetch email messages from the server. The POP service listens on TCP port number 110. Both services may be running on the same host computer, in which case the port number distinguishes the service that was requested by a remote computer, be it a user's computer or another mail server.


While the listening port number of a server is well defined (IANA calls these the well known ports), the client's port number is often chosen from the dynamic port range (see below). In some applications, the client and the server each use specific port numbers assigned by the IANA.

A good example of this is DHCP in which the client always uses UDP port 68 and the server always uses UDP port 67.


Common port numbers


The Internet Assigned Numbers Authority (IANA) is responsible for the global coordination of the DNS Root, IP addressing, and other Internet protocol resources. This includes the registration of commonly used port numbers for well-known Internet services.

The port numbers are divided into three ranges: the well-known ports, the registered ports, and the dynamic or private ports. The well-known ports are those from 0 through 1023. Examples include:

21: FTP

23: Telnet

53: Domain Name System

80: World Wide Web HTTP

119: Network News Transfer Protocol

443: HTTP over Transport Layer Security/Secure Sockets Layer

445: microsoft-ds, Server Message Block over TCP



21: 文件传输协议)

23: 以太网

53: 域名解析系统

80: 万维网超文本传输协议

119: 网络新闻传输协议

443: 传输安全层/安全套接字层超文本传输协议

445: 端口,TCP服务器消息块

The registered ports are those from 1024 through 49151. A list of registered ports may be found on the IANA Website. The dynamic or private ports are those from 49152 through 65535 (see ephemeral port).