How Linux can modify the TCP port range

  
                

The TCP port range of the Linux system can be modified. Appropriately adjust the TCP port range to meet individual needs. How do you modify the TCP port range? Let's take a look at the examples.

In the Customize Start service when you want to use port 8370, but found nginx or node port has been occupied, can not start. However, lvs has already applied for it, and it is more troublesome to change the port. So you can modify the /proc/sys/net/ipv4/ip_local_port_range parameter to enable the port assigned by the tcp protocol to be enabled from a larger range, so that node or nginx will not occupy a smaller port.

Code is as follows

echo ‘32768 61000’ 》 /proc/sys/net/ipv4/ip_local_port_range

Added: Temporary Port Range Adjustment

You You can use the netstat command to show how many connections are in this state: [If it is a production environment, it is best to test first, then consider the appropriate range of a port]

The code is as follows

shell Netstat -n

Copyright © Windows knowledge All Rights Reserved