Skip to the content.

TCP Connect Timeout (Client Side)

Introduction

The tcp_syn_retries variable. Since Linux 2.2.

The maximum number of times initial SYNs for an active TCP connection attempt will be retransmitted. This value should not be higher than 255. The default value is 6, which corresponds to retrying for up to approximately 127 seconds.

Before Linux 3.7, the default value was 5, which (in conjunction with calculation based on other kernel parameters) corresponded to approximately 180 seconds.

See tcp_syn_retries - Debian Manpages

OS Configuration

$ cat /proc/sys/net/ipv4/tcp_syn_retries
6
$ sysctl net.ipv4.tcp_syn_retries
net.ipv4.tcp_syn_retries = 6

sysctl -w net.ipv4.tcp_syn_retries = 2
// linux kernel 2.6.32
icsk->icsk_rto = min(icsk->icsk_rto << 1, TCP_RTO_MAX)

Python Examples or Recipes

References