Related concepts:
In Network technology, ports (port) consist of two types: logical port and physical port.
A physical port is a physical port, such as an ADSL Modem, a hub, a switch, an interface on a router that is used to connect to other network devices, such as a RJ-45 port, SC port, and so on.
A logical port is a logical port used to differentiate services, such as a service port in the TCP/IP protocol, with a port number ranging from 0 to 65535, such as 80 ports for browsing Web services, 21 ports for FTP services, and so on.
由于物理端口和逻辑端口数量较多,为了对端口进行区分,将每个端口进行了编号,这就是端口号端口按端口号可以分为3大类:* 公认端口(Well Known Port)公认端口号从0到1023,它们紧密绑定与一些常见服务,例如FTP服务使用端口21,你在 /etc/services 里面可以看到这种映射关系。* 注册端口(Registered Ports):从1024到49151。它们松散地绑定于一些服务。也就是说有许多服务绑定于这些端口,这些端口同样用于许多其它目的.* 动态或私有端口(Dynamic and/or Private Ports)动态端口,即私人端口号(private port numbers),是可用于任意软件与任何其他的软件通信的端口数,使用因特网的传输控制协议,或用户传输协议。动态端口一般从49152到65535Linux中有限定端口的使用范围,如果我要为我的程序预留某些端口,那么我需要控制这个端口范围。/proc/sys/net/ipv4/ip_local_port_range定义了本地TCP/UDP的端口范围,你可以在/etc/sysctl.conf里面定义net.ipv4.ip_local_port_range = 1024 65000[[email protected] ~]# cat /proc/sys/net/ipv4/ip_local_port_range1024 65000[[email protected] ~]# echo ‘1024 65535‘ > /proc/sys/net/ipv4/ip_local_port_range
Linux View server open port number