我正在一个非常慢的接口上编写linux设备驱动程序,其ping时间可能长达几分钟。当我尝试使用TCP在两个节点之间建立连接时,连接总是超时。
是否有一种方法可以在驱动程序中设置更长的TCP重传或握手超时,还是有任何命令可以设置它?感谢
答案 0 :(得分:5)
您是否尝试过搜索此问题的答案?谷歌快速搜索给了我this,这似乎直接解决了这个问题。摘要是net.ipv4.tcp_syn_retries
的设置确定TCP连接可用的最大超时。
如果该文件没有回答您的问题,您应该说明您的尝试以及行为与您的预期有何不同。
答案 1 :(得分:2)
以下链接是否回答了您的问题?
答案 2 :(得分:1)
/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.