Set the port range for Linux/Windows

Source: Internet
Author: User

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:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.