Table of Contents

# TCP hang on dead ip

When a TCP connection is made to an IP which machine is powered off or shutdown, the TCP would hang a long time; It may be caused by the retry strategy of Linux default setup net.ipv4.tcp_syn_retries, default value is 6 which would totally use 63 seconds. (1 + 2 + 4 + 8 + 16 + 32 = 63)

Set net.ipv4.tcp_syn_retries to 2

temporary setup

sysctl -w net.ipv4.tcp_syn_retries=2

persistence using drop-in config in /etc/sysctl.d/*.confg

net.ipv4.tcp_syn_retries=2