Skip to content

Instantly share code, notes, and snippets.

@raphaunix
Last active August 20, 2017 13:57
Show Gist options
  • Save raphaunix/c00cc9b70318ec46b988847126faf96d to your computer and use it in GitHub Desktop.
Save raphaunix/c00cc9b70318ec46b988847126faf96d to your computer and use it in GitHub Desktop.
java.net.NoRouteToHostException SOLVED
SOLVED
java.net.NoRouteToHostException
cat /proc/sys/net/ipv4/ip_local_port_range
32768 - 61000
Solution
1. Lowest waiting time to release the door, the default is 60, modified to 15 ~ 30s
echo 30 >/proc/sys/net/ipv4/tcp_fin_timeout
2. The default is 0, change to 1 to release a new connection to a TIME_WAIT port.
echo 1 >/proc/sys/net/ipv4/tcp_tw_reuse
3. Modify TCP / IP protocol configuration, fast recovery of socket resources, default is 0, modify to 1.
echo 1 >/proc/sys/net/ipv4/tcp_tw_recycle
The whole process in one line:
echo 30 >/proc/sys/net/ipv4/tcp_fin_timeout && echo 1 >/proc/sys/net/ipv4/tcp_tw_reuse && echo 1 >/proc/sys/net/ipv4/tcp_tw_recycle
Ref: http://www.itdadao.com/articles/c15a1389796p0.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment