Cannot assign requested address

Open source software supply chain lighting plan, waiting for you>>>

At the beginning of today’s stress test, there were many exceptions, all of which were cannot assign requested address

According to the information on the Internet, it is due to the exhaustion of the client connection port allocated by Linux and the failure to establish a socket connection. Although the socket is normally closed, the port is not released immediately, but is in time_ Wait state, wait for 60s by default before releasing.

Check the range of client connection ports supported by Linux, that is, 28232 ports

cat /proc/sys/net/ipv4/ip_ local_ port_ range

32768 – 61000


1. Reduce the waiting time after port release, which is 60 s by default and 15 ~ 30 s by modification

echo 30 >/proc/sys/net/ipv4/tcp_ fin_ timeout

2. Modify the TCP/IP protocol configuration by configuring/proc/sys/net/IPv4/TCP_ tw_ Reset, default to 0, modify to 1, release time_ The wait port is used for new connections.

echo 1 >/proc/sys/net/ipv4/tcp_ tw_ reuse

3. Modify the TCP/IP protocol configuration to recycle socket resources quickly. The default value is 0 and the value is 1

echo 1 >/proc/sys/net/ipv4/tcp_ tw_ recycle

Through the above three adjustments, the pressure test runs normally.

Similar Posts: