How to disable the TCP ECN ?

Solution Verified - Updated -

Environment

  • Red Hat Enterprise Linux (RHEL)

Issue

  • How to disable the TCP ECN?
  • How to disable the TCP ECE & CWR fields?

Resolution

The ECN uses ECE and CWR fields of TCP headers and disabling net.ipv4.tcp_ecn will disable the CWR & ECE fields.

Root Cause

Control use of Explicit Congestion Notification (ECN) by TCP. ECN is used only when both ends of the TCP connection indicate support for it. This feature is useful in avoiding losses due to congestion by allowing supporting routers to signal congestion before having to drop packets.
Possible values are:

tcp_ecn - INTEGER

0 Disable ECN.  Neither initiate nor accept ECN.
1 Enable ECN when requested by incoming connections and also, request ECN on outgoing connection attempts.
2 Enable ECN when requested by incoming connections but do not request ECN on outgoing connections.
Default: 2

Diagnostic Steps

Verify ECN state using tcpdump:

Enabling the ECN sysctl and verifying SYN packet with tcpdump
# sysctl -w net.ipv4.tcp_ecn=1
net.ipv4.tcp_ecn = 1

   Flags: 0x0c2 (SYN, ECN, CWR)
        000. .... .... = Reserved: Not set
        ...0 .... .... = Nonce: Not set
        .... 1... .... = Congestion Window Reduced (CWR): Set  <<---  CWR is enabled
        .... .1.. .... = ECN-Echo: Set                         <<--- ECN is enabled
        .... ..0. .... = Urgent: Not set
        .... ...0 .... = Acknowledgment: Not set
        .... .... 0... = Push: Not set
        .... .... .0.. = Reset: Not set
        .... .... ..1. = Syn: Set

Disabling the ECN sysctl and verifying SYN packet with tcpdump
# sysctl -w net.ipv4.tcp_ecn=0
net.ipv4.tcp_ecn = 0

    Flags: 0x002 (SYN)
        000. .... .... = Reserved: Not set
        ...0 .... .... = Nonce: Not set
        .... 0... .... = Congestion Window Reduced (CWR): Not set  <<----  CWR is disabled
        .... .0.. .... = ECN-Echo: Not set                         <<---- ECN is disabled
        .... ..0. .... = Urgent: Not set
        .... ...0 .... = Acknowledgment: Not set
        .... .... 0... = Push: Not set
        .... .... .0.. = Reset: Not set
        .... .... ..1. = Syn: Set

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments