开发者

Custom TCP Parameters for multiple interfaces in Linux

开发者 https://www.devze.com 2023-02-10 08:14 出处:网络
My question is about TCP parameters in Linux. By now, I want to change the default values of: Initial Timeout

My question is about TCP parameters in Linux. By now, I want to change the default values of:

  • Initial Timeout
  • ACK Delay
  • Idle Connection Timeout
  • I have a Linux Box with kernel 2.6开发者_开发问答.x and 2 ethernet interfaces. I know TCP is a stack that doesn't have anything to do with ethernet devices. Said that, the question: is there a way to set custom values for each interface? For example, a server listening to connections in eth0 would use one value for Idle Connection Timeout and another server listening to connections in eth1 could use a different value for that parameter.

    Any considerations will be appreciated.

    Best Regards,

    Tiago


    Looks like delayed ACK is hard-coded here:

    #define TCP_DELACK_MAX  ((unsigned)(HZ/5))      /* maximal time to delay before sending an ACK */
    #if HZ >= 100
    #define TCP_DELACK_MIN  ((unsigned)(HZ/25))     /* minimal time to delay before sending an ACK */
    

    By idle connection timeout you probably mean TCP keep alive. This you also can not set per interface. Here it explained. Values that controls TCP keep alive behaviour are configured by following files:

    /proc/sys/net/ipv4/tcp_keepalive_time
    /proc/sys/net/ipv4/tcp_keepalive_intvl
    /proc/sys/net/ipv4/tcp_keepalive_probes
    

    By default TCP connection had TCP keep alive disabled. Appliation willing to use the feature should enable it by calling setsockoption(2) with SO_KEEPALIVE.


    As far as I can tell, you can't.

    You can either set kernel parameters for the tcp stack (try doing a sysctl -a | grep tcp), or set parameters on a TCP socket (see man tcp), but neither will give you control over the ACK delay. This is coded in /usr/src/<kernels>/include/net/tcp.h, if you have the kernel source.

    0

    精彩评论

    暂无评论...
    验证码 换一张
    取 消

    关注公众号