When you start a custom service, you want to use port 8370, but you find that the port is already occupied by nginx or node and cannot be started. But LVs has also applied, change port is more troublesome. So you can modify the next/proc/sys/net/ipv4/ip_local_port_range parameter to enable the TCP protocol to allocate ports from a larger range, so that node or nginx will not occupy the smaller port.
The code is as follows |
Copy Code |
Echo ' 32768 61000 ' >/proc/sys/net/ipv4/ip_local_port_range
|
Supplemental: Temporary port range Adjustment
You can use the netstat command to show how many connections are in this state: [In a production environment, it is best to test first, and then consider the appropriate range of a port]
The code is as follows |
Copy Code |
Shell>netstat-n | grep time_wait ...... Shell>cat/proc/sys/net/ipv4/ip_local_port_range 32768 61000
|
If you need to modify the echo "Start-number End-number", Start-number and End-number are the number within the range of the 0-65536 port number, and 0-1024 is best not to use, usually known as the port, if it is a dedicated proxy server, Many well-known ports are not used, of course you can consider!
Don't forget to add the echo command to the system startup script to take effect every time the machine restarts