Set the port range for Linux/Windows
Set the port range for Linux/Windows
Recently, the program failed to start because the port occupied the listening port. Therefore, I checked some information and saw where to set it.
--------------------------------------------------------------------------------
Linux (CentOS ):
The default value is 32768-61000.
Modification method:
Add the following configuration in/etc/sysctl. conf: (Open 20000-50000 as the completion port)
Net. ipv4.ip _ local_port_range = 20000 50000
Restart the platform after the configuration is complete, or enter sysctl-p to take effect immediately.
Command
Sysctl net. ipv4.ip _ local_port_range
View related configurations.
--------------------------------------------------------------------------------
Windows Server 2008/Win7/Vista: (enabling ipv-50000 is the completion port)
The default value is 49152-65535.
Modification method:
Netsh int ipv4 set dynamicportrange tcp startport = 10000 numberofports = 400001
After the configuration is complete, you can use
Netsh int ipv4 show dynamicportrange tcp
View the effect.
--------------------------------------------------------------------------------
Windows Server 2003:
The default open port range is 1024-5000.
Modification method:
You can go to the Registry path
HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ services \ Tcpip \ Parameters
Add a Dword field MaxUserPort and configure the maximum port number (minimum cannot be changed ).
This article permanently updates the link address: