Weighted Random Early Detection (WRED) is implemented at the core routers of a network. Edge routers assign IP precedences
to packets, as the packets enter the network. With WRED, core routers then use these precedences to determine how to treat
different types of traffic. WRED provides separate thresholds and weights for different IP precedences, enabling the network
to provide different qualities of service, in regard to packet dropping, for different types of traffic. Standard traffic
may be dropped more frequently than premium traffic during periods of congestion.
ECN is an extension to WRED. ECN marks packets instead of dropping them when the average queue length exceeds a specific threshold
value. When configured, ECN helps routers and end hosts to understand that the network is congested and slow down sending
packets. However If the number of packets in the queue is above the maximum threshold, packets are dropped based on the drop
probability. This is the identical treatment that a packet receives when WRED is enabled without ECN configured on the router.
RFC 3168, The Addition of Explicit Congestion Notification (ECN) to IP, states that with the addition of active queue management (for example, WRED) to the Internet infrastructure, routers are
no longer limited to packet loss as an indication of congestion.
![](https://www.cisco.com/content/dam/en/us/td/i/templates/note.gif)
Note
|
You cannot use this feature when you have set qos-group or mpls experimental along with a traffic class in the ingress policy.
|
Implementing ECN
Implementing ECN requires an ECN-specific field that has 2 bits—the ECN-capable Transport (ECT) bit and the CE (Congestion
Experienced) bit—in the IP header. The ECT bit and the CE bit can be used to make four ECN field combinations of 00 to 11.
The first number is the ECT bit and the second number is the CE bit.
Table 1. ECN Bit Setting
ECT Bit
|
CE Bit
|
Combination Indicates
|
0
|
0
|
Not-ECN-capable.
|
0
|
1
|
Endpoints of the transport protocol are ECN-capable.
|
1
|
0
|
Endpoints of the transport protocol are ECN-capable.
|
1
|
1
|
Congestion experienced.
|
The ECN field combination 00 indicates that a packet is not using ECN. The ECN field combinations 01 and 10—Called ECT(1)
and ECT(0), respectively—are set by the data sender to indicate that the endpoints of the transport protocol are ECN-capable.
Routers treat these two field combinations identically. Data senders can use either one or both of these two combinations.
The ECN field combination 11 indicates congestion to the endpoints. Packets arriving a full queue of a router will be dropped.
Packet Handling When ECN Is Enabled
When the number of packets in the queue is below the minimum threshold, packets are transmitted. This happens whether ECN
is enabled or not, and this treatment is identical to the treatment a packet receives when WRED only is being used on the
network.
If the number of packets in the queue is above the maximum threshold:
-
For traffic flows that are not ECN-enabled in only WRED-configured queues, packets are tail-dropped after the queue size exceeds
the WRED maximum threshold.
-
For traffic flows that are ECN-enabled in only WRED-configured queues, packets are tail-dropped when the queue size exceeds
the tail-drop threshold.
-
When you configure ECN remarking on your router, incoming packets with ECT bit settings 0 or 1 are marked as CE.
![](https://www.cisco.com/content/dam/en/us/td/i/templates/note.gif)
Note
|
When the number of packets reaches the queue limit, all packets are dropped. This is the identical treatment that a packet
receives when you enable WRED without ECN configured on the router.
|
Three different scenarios arise if the number of packets in the queue is between the minimum threshold and the maximum threshold:
-
If the ECN field on the packet indicates that the endpoints are ECN-capable (that is, the ECT bit is set to 1 and the CE bit
is set to 0, or the ECT bit is set to 0 and the CE bit is set to 1)—and the WRED algorithm determines that the packet should
have been dropped based on the drop probability—the ECT and CE bits for the packet are changed to 1, and the packet is transmitted.
This happens because ECN is enabled and the packet gets marked instead of dropped.
-
If the ECN field on the packet indicates that neither endpoint is ECN-capable (that is, the ECT bit is set to 0 and the CE
bit is set to 0), packet is dropped once the queue limit is reached.
-
If the ECN field on the packet indicates that the network is experiencing congestion (that is, both the ECT bit and the CE
bit are set to 1), the packet is transmitted. No further marking is required.
![](https://www.cisco.com/content/dam/en/us/td/i/templates/note.gif)
Note
|
When the incoming IP traffic with ECN bits set to 10 passes through the ingress qos-policy-map that has the class-map definition
of set DSCP/PREC <value> , then the ECN bits in the IP header gets modified to 01.
|
Configuration Example
Router# configure
Router(config)# policy-map policy1
Router(config-pmap)# class class1
Router(config-pmap-c)# bandwidth percent 50
Router(config-pmap-c)# random-detect 1000 packets 2000 packets
Router(config-pmap-c)# random-detect ecn
Router(config-pmap-c)# exit
Router(config-pmap)# exit
Router(config)# commit
Verification
Use the show policy-map interface to verify the configuration.
Router# show policy-map interface tenGigE 0/0/0/6 output
TenGigE0/0/0/6 output: pm-out-queue
Class cm-tc-1
Classification statistics (packets/bytes) (rate - kbps)
Matched : 85528554/87581239296 4830672
Transmitted : 16240891/16630672384 966585
Total Dropped : 69287663/70950566912 3864087
Queueing statistics
Queue ID : 1113
Taildropped(packets/bytes) : 69287663/70950566912
WRED profile for
RED Transmitted (packets/bytes) : N/A
RED random drops(packets/bytes) : N/A
RED maxthreshold drops(packets/bytes) : N/A
RED ecn marked & transmitted(packets/bytes): N/A
Class class-default
Classification statistics (packets/bytes) (rate - kbps)
Matched : 0/0 0
Transmitted : 0/0 0
Total Dropped : 0/0 0
Queueing statistics
Queue ID : 1112
Taildropped(packets/bytes) : 0/0
![](https://www.cisco.com/content/dam/en/us/td/i/templates/note.gif)
Note
|
No ECN-specific statistics are displayed in the show output for this command. ECN is enabled if all rows indicate N/A , as highlighted in the example.
|