2

Our application connects to a device on a radio network. The network has to wake up the device before it can communicate which takes about 3 seconds. In this 3 seconds our CentOS (Linux 3.10.0-957.62.1.el7.x86_64 x86_64) machines sends 2 retransmissions of the TCP SYN packet. The retransmission cause problems on the radio network so I'd like to wait with retransmissions for at least 3 seconds.

Lowering tcp_syn_retries doesn't really change the first retries and gives unwanted behavior when configured below 4 (which is also not advised). It just reduces retries but still follows the same pattern of retries (just less of them).

Setting tcp_frto to 1 and setting tcp_low_latency to 1 did not have the desired effect.

A similar question for Windows is posted here

How do I change the TCP SYN retransmission schema on Linux?

Martin
  • 121
  • 5

1 Answers1

3

The tcp retransmission of the syn is related with the receive timeout (rto) value (see the source code). By default it equals 1 second (defined here and here; min = 0.2 sec, max = 120 sec).

You can change the rto value for specified route with ip util.

ip route replace 0/0 via <wifi-gw> dev <wifi-iface> rto_min 5s

But the application itself can change the rto value with the setsockopt call.

Anton Danilov
  • 5,082
  • 2
  • 13
  • 23
  • I added the route with `rto_min` set to 5s but didn't see any change, still retransmissions after 1 and 3 seconds for the SYN packets. In the source I see in `tcp_connect_init` this: `inet_csk(sk)->icsk_rto = TCP_TIMEOUT_INIT;` and `TCP_TIMEOUT_INIT` is hardcoded. Does this mean I can't change this? Does rto_min only influence retransmissions after successful connection? – Martin Dec 18 '20 at 08:42