Home  >  Article  >  Operation and Maintenance  >  what is linux port

what is linux port

爱喝马黛茶的安东尼
爱喝马黛茶的安东尼Original
2019-12-07 14:43:468025browse

what is linux port

Services provide functions to the system. In addition to system services, there are also network services in the system. Each network service has its own port, and generally the port number is fixed. So, what is a port?

We know that the IP address is the address number of the computer on the Internet. Each networked computer must have its own IP address, and it must be unique so that it can communicate normally. In other words, the location of different computers on the Internet is determined by IP addresses.

You can think of the IP address as the "house number" of your family. No matter you live in a courtyard, an apartment building or a villa, you have your own house number, and the house number is unique.

If we know the IP address of a server, we can find the server. However, there may be multiple network services built on this server, such as WWW service, FTP service, and Mail service. So which network service do we need the server to provide us? At this time, it is necessary to distinguish by port, because the port corresponding to each network service is fixed.

For example, the port corresponding to the WWW service is 80, the ports corresponding to the FTP service are 20 and 21, and the corresponding ports to the Mail service are 25 and 110. In other words, the IP address can be imagined as a "house number", and the port can be imagined as a "family member". If you find the IP address, you can only find your home. Only if you find the port, you can find the real recipient when sending a letter.

In order to unify the corresponding relationship between ports and network services on the entire Internet, so that all hosts can use the same mechanism to request or provide services, and the same service uses the same port, this is the protocol.

The protocols in computers are mainly divided into two categories:

The connection-oriented and reliable TCP protocol (Transmission Control Protocol, Transmission Control Protocol);

The connection-oriented Unreliable UDP protocol (User Datagram Protocol);

Both protocols support 216, which is 65535 ports. How to remember so many ports? The system provides us with the corresponding file /etc/services for services and ports. Check out:

[root@localhost ~]#vi /etc/services
…省略部分输出…
ftp-data 20/tcp
ftp-data 20/udp
# 21 is registered to ftp, but also used by fsp
ftp 21/tcp
ftp 21/udp
fsp fspd
#FTP服务的端口
…省略部分输出…
smtp 25/tcp mail
smtp 25/udp mail
#邮件发送信件的端口
…省略部分输出…
http 80/tcp www www-http #WorldWideWeb HTTP
http 80/udp www www-http #HyperText Transfer Protocol
#WWW服务的端口
…省略部分输出…
pop3 110/tcp pop-3
# POP version 3
pop3 110/udp pop-3
#邮件接收信件的端口
…省略部分输出…

Can the port of the network service be modified? Of course it is possible, but once the port is modified, it will be difficult for the client to know what the port corresponding to the server is when accessing the server, and it will not be able to obtain the service correctly. Therefore, unless in an experimental environment, do not modify the port corresponding to the network service.

PHP Chinese website has a large number of free Linux introductory tutorials, everyone is welcome to learn!

The above is the detailed content of what is linux port. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn