java.net.NoRouteToHostException: Can not assign requested address issues analysis

 

 

problem:

Cause: Due to liunx assigned client port exhausted, unable to establish a socket connection caused, although the socket normally closed, but the port is not released immediately, but in the TIME_WAIT state, the default wait 60s after release.
View liunx support client connections port range is 28,232 ports. cat /proc/sys/net/ipv4/ip_local_port_range
32768 - 61000

Solution:
1. lower the waiting time after the release port, the default is 60s, modified to 15 ~ 30s. echo 30 > /proc/sys/net/ipv4/tcp_fin_timeout
2. Modify tcp / ip protocol configuration, configured by  /proc/sys/net/ipv4/tcp_tw_reusedefault to 0, 1 is modified, the release TIME_WAITport to the new connection. echo 1 > /proc/sys/net/ipv4/tcp_tw_reuse
3. Modify ctp / ip protocol configuration, rapid recovery of socket resources, the default is changed to 0. 1.echo 1 > /proc/sys/net/ipv4/tcp_tw_recycle

https://blog.csdn.net/weixin_43757847/article/details/88188091

https://my.oschina.net/shichangcheng/blog/1560864

https://stackoverflow.com/questions/32282112/error-setting-net-ipv4-tcp-tw-reuse-net-ipv4-tcp-tw-recycle-in-sysctl-conf

 

Wei Cheng Jun to help find the

 

Guess you like

Origin www.cnblogs.com/kaibindirver/p/11779465.html