web-dev-qa-db-ja.com

LinuxネットワークデバイスのTCPタイムアウトを変更する

私は非常に遅いインターフェイスを介してLinuxデバイスドライバーをプログラミングしています。そのpingラウンドタイムは数分にもなる場合があります。 TCPを使用して2つのノード間の接続を確立しようとすると、接続が常にタイムアウトします。

ドライバにTCP再送信またはハンドシェイクのタイムアウトを長く設定する方法はありますか?それを設定するコマンドはありますか?ありがとう

9
Yifan Sun

この質問に対する回答を検索してみましたか?簡単なGoogle検索で this が得られ、この問題に直接対処しているようです。要約すると、net.ipv4.tcp_syn_retriesは、TCP接続で利用可能な最大タイムアウトを決定します。

そのドキュメントが質問に答えない場合は、何を試みたか、および動作が予想とどのように異なっていたかを示す必要があります。

6
larsks
/proc/sys/net/ipv4/tcp_retries1
/proc/sys/net/ipv4/tcp_retries2

tcp_retries1 - INTEGER


 This value influences the time, after which TCP decides, that
    something is wrong due to unacknowledged RTO retransmissions,
    and reports this suspicion to the network layer.
    See tcp_retries2 for more details.

    RFC 1122 recommends at least 3 retransmissions, which is the
    default.


tcp_retries2 - INTEGER

This value influences the timeout of an alive TCP connection,
when RTO retransmissions remain unacknowledged.
Given a value of N, a hypothetical TCP connection following
exponential backoff with an initial RTO of TCP_RTO_MIN would
retransmit N times before killing the connection at the (N+1)th RTO.

The default value of 15 yields a hypothetical timeout of 924.6
seconds and is a lower bound for the effective timeout.
TCP will effectively time out at the first RTO which exceeds the
hypothetical timeout.

RFC 1122 recommends at least 100 seconds for the timeout,
which corresponds to a value of at least 8.
2
Satish