Since Linux TCP connection problems

[Reference article]: value net.ipv4.ip_local_port_range exactly what impact the

[Reference] article: Linux kernel parameter optimization

 

  Recently uninstall MySQL service occasionally encounter MySQL port from connection problems. Leading to uninstall MySQL service fails, you need to manually kill the process from the connection before you can uninstall operation.

  What is self-connection problems?

  Since the connection is connected to their own phenomenon. When we go to a port is listening, our system automatically assign a temporary port to connect, which makes it possible to assign a port number that is listening, and then there was his connection own problems.

1. The temporary port

  When the start socket to connect an IP port number on the server, the system will randomly assign a temporary port to connect the target socket.

  Temporary port number range can be set.

  vim  /etc/sysctl.conf 

  net.ipv4.ip_local_port_range = 1024 65535 # ephemeral port range is indicated, the default range is 1024-65535,

  Seems to support setting a section of the port, multiple ports arrangement segments not found.

  I follow the default configuration, a plurality of ports segment (for example: 1024 3306330765535) I was blind Mongolia, has been tested and found that only the first paragraph comes into port, and we do believe that only support one port segment

2. reserved port number

  Reserved port number is the port number reserved for third-party components, the port will not be assigned at the time of allocation of temporary port.

  Server kernel version is greater than 2.6.18-164, or do not support this parameter

  vim  /etc/sysctl.conf 

  net.ipv4.ip_local_reserved_ports = 3306 # reserved port number

  Support for multiple port configuration section

  net.ipv4.ip_local_reserved_ports=3306,3308-3310,3312

  

Guess you like

Origin www.cnblogs.com/virgosnail/p/11608085.html