Working of ECN - rajitaaa/ECN-plus-algorithm-in-ns3 GitHub Wiki

Introduction to ECN:

  • End-to-end notification of network congestion without dropping packets.
  • Can be used only between two ECN-enabled endpoints.
  • Underlying network infrastructure should support it.
  • When ECN is successfully negotiated, an ECN-aware router may set a mark in the IP header instead of dropping a packet in order to signal impending congestion.
  • The receiver of the packet echoes the congestion indication to the sender, which reduces its transmission rate as if it detected a dropped packet.
  • ECN requires specific support at both the network layer and the transport layer

Operation of ECN with IP

ECN uses the two least significant (right-most) bits of the DiffServ field in the IPv4 or IPv6 header to encode four different code points:

  • 00 – Non ECN-Capable Transport, Non-ECT
  • 10 – ECN Capable Transport, ECT(0)
  • 01 – ECN Capable Transport, ECT(1)
  • 11 – Congestion Encountered, CE.

Operation of ECN with TCP

TCP supports ECN using three flags in the TCP header.

  • The first one, the Nonce Sum (NS), is used to protect against accidental or malicious concealment of marked packets from the TCP sender.
  • The second bit are used to echo back the congestion indication (i.e. signal the sender to reduce the amount of information it sends) and called the ECN-Echo bit.
  • The third bit is to acknowledge that the congestion-indication echoing was received and known as the Congestion Window Reduced (CWR) bit.

ECN and TCP control packets

Since the Transmission Control Protocol (TCP) does not perform congestion control on control packets (pure ACKs, SYN, FIN segments), control packets are usually not marked as ECN-capable.

The client first sets the ECN-Echo bit in the TCP header of a TCP SYN packet and sends this packet to the receiver. For a SYN packet, the ECN-Echo bit is defined as an indication that the sending TCP is ECN-capable. Upon receiving the TCP SYN packet, the server sets the ECN-Echo bit in the SYN-ACK packet’s TCP header, and sends this packet back to the client. When the client receives the above SYN ACK packet, the ECN capability is negotiated, and both endpoints start an ECN-capable transport by setting the ECT field in the IP header of data packets. In moments of congestion, the ECN-enabled router marks ECT-enabled packets by setting the ECN/CE bit in the IP header. When such packets reach the client, the client sets the ECN-Echo bit in the TCP header of the corresponding ACK packet thus signaling to the server that the incoming data packet has experienced congestion.