Enable TCP SACK on a Linux instance

更新时间:
复制 MD 格式

Learn how to enable TCP Selective Acknowledgment (SACK) on a Linux instance.

Note

If TCP SACK is disabled, the network performance of your Linux instance might be degraded. Follow the steps in this topic to enable it.

Procedure

Note

The steps in this topic use CentOS 7.4 as an example. The procedure may vary for other operating systems. For specific instructions, consult your OS's official documentation.

  1. Connect to the Linux instance using VNC.

    For more information, see Connect using VNC.

  2. Edit the /etc/sysctl.conf file:

    vim /etc/sysctl.conf
  3. Enable TCP SACK.

    • If the net.ipv4.tcp_sack parameter already exists:

      1. Press the i key to enter Insert mode.

      2. Change net.ipv4.tcp_sack = X to net.ipv4.tcp_sack = 1.

      3. To save the file and exit, press the Esc key, type :wq, and then press the Enter key.

    • If the net.ipv4.tcp_sack parameter does not exist:

      1. Press the i key to enter Insert mode.

      2. Add the following to the end of the file:

        net.ipv4.tcp_sack = 1

        Your file should now look similar to the following:

        net.ipv4.conf.default.arp_announce = 2
        net.ipv4.conf.lo.arp_announce = 2
        net.ipv4.conf.all.arp_announce = 2
        # see details in https://help.aliyun.com/knowledge_detail/41334.html
        net.ipv4.tcp_max_tw_buckets = 5000
        net.ipv4.tcp_syncookies = 1
        net.ipv4.tcp_max_syn_backlog = 1024
        net.ipv4.tcp_synack_retries = 2
        net.ipv6.conf.all.disable_ipv6 = 0
        net.ipv6.conf.default.disable_ipv6 = 0
        net.ipv6.conf.lo.disable_ipv6 = 0
        kernel.sysrq = 1
        net.ipv4.tcp_sack = 1
      3. To save the file and exit, press the Esc key, type :wq, and then press the Enter key.

  4. Apply the changes:

    sysctl -p