# Example Traffic Class Configuration for Differentiated Services

The commands in this example illustrate a partial network configuration that supports four differentiated service classes on a particular tunnel: a best-effort class, two assured forwarding classes, and an expedited forwarding class. Table 59 presents the mapping between EXP bits, PHB, PHB ID, and traffic class/color combination.

Table 59: Differentiated Services Mapping

EXP | PHB | PHB ID | 6-bit PHB ID | Traffic Class/Color
--- | --- | --- | --- | ---
000 | BE | 0x0000 | 00 | best-effort/green
001 | AF11 | 0x2800 | 10 | af1/green
010 | AF12 | 0x3000 | 12 | af1/yellow
011 | AF13 | 0x3800 | 14 | af1/red
100 | AF21 | 0x4800 | 18 | af2/green
101 | AF22 | 0x5000 | 20 | af2/yellow
110 | AF23 | 0x5800 | 22 | af2/red
111 | EF | 0xb800 | 46 | ef/green

| Note: This example includes both MPLS and policy configuration commands, and assumes that you are thoroughly familiar with the information and commands presented in the JunosE Policy Management Configuration Guide.

The four traffic classes are configured to allocate fabric resources and allow global synchronization of the three segments of the data path through an E Series router: ingress, fabric, and egress. The JunosE Software automatically creates the best-effort traffic class, with a default weight of eight. You must define the remaining three classes, af1, af2, and ef. In this example, the af1 class has twice as much fabric bandwidth as the best-effort class, and the af2 class has twice as much fabric bandwidth as the af1 class. The expedited forwarding traffic (the ef class) requires strict-priority queuing.

host1(config)#traffic-class af1 host1(config-traffic-class)#fabric-weight 16 host1(config)#traffic-class af2 host1(config-traffic-class)#fabric-weight 32 host1(config)#traffic-class ef host1(config-traffic-class)#fabric-strict-priority

Define two scheduler profiles for the af1 and af2 classes on the egress line modules:

host1(config)#scheduler-profile af1-scheduler-profile host1(config-scheduler-profile)#weight 16 host1(config)#scheduler-profile af2-scheduler-profile host1(config-scheduler-profile)#weight 32

Create queue profiles to define how queues are instantiated to implement the corresponding traffic classes and PHBs. The JunosE Software automatically creates the best-effort queue profiles.

host1(config)#queue-profile af1-queues [Queue configuration omitted]host1(config)#queue-profile af2-queues [Queue configuration omitted]host1(config)#queue-profile ef-queues [Queue configuration omitted]

The scheduler and queue profiles are referenced in QoS profiles. For example, you can create a QoS profile for port-based per-class queuing or for LSP-level per-class queuing (configuration omitted).

You must map the PHB IDs to the appropriate traffic class/color combinations:

host1(config)#mpls diff-serv phb-id standard 0 traffic-class best-effort color green host1(config)#mpls diff-serv phb-id standard 10 traffic-class af1 color green host1(config)#mpls diff-serv phb-id standard 12 traffic-class af1 color yellow host1(config)#mpls diff-serv phb-id standard 14 traffic-class af1 color red host1(config)#mpls diff-serv phb-id standard 18 traffic-class af2 color green host1(config)#mpls diff-serv phb-id standard 20 traffic-class af2 color yellow host1(config)#mpls diff-serv phb-id standard 22 traffic-class af2 color red host1(config)#mpls diff-serv phb-id standard 46 traffic-class ef color green

## Configuration on the Ingress Router

You must access the tunnel interface to map the PHB IDs to the EXP bits. The E Series router signals this mapping to all routers on the tunnel. You can establish different PHB-ID–to–EXP mappings for different tunnels.

host1(config)#interface tunnel mpls:example

PHB-ID–to–EXP mapping for the best-effort traffic class:

host1(config-if)#tunnel mpls diff-serv phb-id standard 0x0000 exp-bits 0

PHB-ID–to–EXP mapping for the af1 traffic class:

host1(config-if)#tunnel mpls diff-serv phb-id standard 10 exp-bits 1 host1(config-if)#tunnel mpls diff-serv phb-id standard 12 exp-bits 2 host1(config-if)#tunnel mpls diff-serv phb-id standard 14 exp-bits 3

PHB-ID–to–EXP mapping for the af2 traffic class:

host1(config-if)#tunnel mpls diff-serv phb-id standard 18 exp-bits 4 host1(config-if)#tunnel mpls diff-serv phb-id standard 20 exp-bits 5 host1(config-if)#tunnel mpls diff-serv phb-id standard 22 exp-bits 6

PHB-ID–to–EXP mapping for the ef traffic class:

host1(config-if)#tunnel mpls diff-serv phb-id standard 46 exp-bits 7

Define classifier control lists to classify the incoming packets into classifier groups. Although not shown here, for each CLACL you must define the rules that will select the appropriate incoming packets: be, af1, af2, or ef.

host1(config)#classifier-list be-packets host1(config)#classifier-list af1-packets host1(config)#classifier-list af2-packets host1(config)#classifier-list ef-packets

Define a policy that maps the selected packets into traffic classes. For the assured forwarding classes, this example uses rate limit profiles to set the colors.

host1(config)#policy-list classify-packets host1(config-policy-list)#traffic-class best-effort classifier-group bf-packets host1(config-policy-list)#traffic-class ef classifier-group ef-packets host1(config-policy-list)#traffic-class af1 classifier-group af1-packets host1(config-policy-list)#traffic-class af2 classifier-group af2-packets host1(config-policy-list)#rate-limit-profile af1-profile classifier-group af1-packets host1(config-policy-list)#rate-limit-profile af2-profile classifier-group af2-packets host1(config)#rate-limit-profile af1-profile host1(config-rate-limit-profile)#committed-rate 6000000 host1(config-rate-limit-profile)#committed-burst 1000000 host1(config-rate-limit-profile)#peak-rate 8000000 host1(config-rate-limit-profile)#peak-burst 1000000 host1(config)#rate-limit-profile af2-profile host1(config-rate-limit-profile)#committed-rate 8000000 host1(config-rate-limit-profile)#committed-burst 1500000 host1(config-rate-limit-profile)#peak-rate 12000000 host1(config-rate-limit-profile)#peak-burst 1000000

You attach the policy to the ingress interface of the ingress router. As packets arrive, they are classified with the internal traffic class/color combination and forwarded into the appropriate queues in the fabric. When the packets are sent into the tunnel out of the ingress router, the EXP bits are set according to the router-generated policy (in this example called mpls-exp-setting) that the JunosE Software automatically attached to the tunnel.

## Configuration on the Ingress and Transit Routers

When the tunnel is established, the JunosE Software automatically creates an output policy to map traffic-class/color combinations to EXP bits and attaches the policy to the outgoing segment of the tunnel. The JunosE Software generates classifier list and policy list names, and creates the EXP-setting policy as if the following commands were entered:

| Note: You do not actually issue these commands; they represent the behavior automatically performed by the router.

host1(config)#mpls classifier-list be-green traffic-class best-effort color green host1(config)#mpls classifier-list ef-green traffic-class ef color green host1(config)#mpls classifier-list af1-green traffic-class af1 color green host1(config)#mpls classifier-list af1-yellow traffic-class af1 color yellow host1(config)#mpls classifier-list af1-red traffic-class af1 color red host1(config)#mpls classifier-list af2-green traffic-class af2 color green host1(config)#mpls classifier-list af2-yellow traffic-class af2 color yellow host1(config)#mpls classifier-list af2-red traffic-class af2 color red host1(config)#mpls policy-list mpls-exp-setting host1(config-policy-list)#mark 0 classifier-group be-green host1(config-policy-list)#mark 1 classifier-group af1-green host1(config-policy-list)#mark 2 classifier-group af1-yellow host1(config-policy-list)#mark 3 classifier-group af1-red host1(config-policy-list)#mark 4 classifier-group af2-green host1(config-policy-list)#mark 5 classifier-group af2-yellow host1(config-policy-list)#mark 6 classifier-group af2-red host1(config-policy-list)#mark 7 classifier-group ef-green

| Note: For a topology-driven LSP, you have to configure and apply the classifier list and policy list manually.

## Configuration on the Transit and Egress Routers

When the tunnel is established, the JunosE Software automatically creates an input policy to match the EXP bits and map them to the traffic-class/color combinations and attaches the policy to the incoming segment of the tunnel. The JunosE Software generates classifier list and policy list names, and creates the policy as if the following commands were entered:

| Note: You do not actually issue these commands; they represent the behavior automatically performed by the router.

host1(config)#mpls classifier-list bf-packets exp 0 host1(config)#mpls classifier-list af11-packets exp 1 host1(config)#mpls classifier-list af12-packets exp 2 host1(config)#mpls classifier-list af13-packets exp 3 host1(config)#mpls classifier-list af21-packets exp 4 host1(config)#mpls classifier-list af22-packets exp 5 host1(config)#mpls classifier-list af22-packets exp 6 host1(config)#mpls classifier-list ef-packets exp 7 host1(config)#mpls policy-list mpls-exp-matching host1(config-policy-list)#traffic-class best-effort classifier-group bf-packets host1(config-policy-list)#traffic-class af1 classifier-group af11-packets host1(config-policy-list)#traffic-class af1 classifier-group af12-packets host1(config-policy-list)#traffic-class af1 classifier-group af13-packets host1(config-policy-list)#traffic-class af2 classifier-group af21-packets host1(config-policy-list)#traffic-class af2 classifier-group af22-packets host1(config-policy-list)#traffic-class af2 classifier-group af23-packets host1(config-policy-list)#traffic-class ef classifier-group ef-packets host1(config-policy-list)#color green classifier-group af11-packets host1(config-policy-list)#color green classifier-group af21-packets host1(config-policy-list)#color yellow classifier-group af12-packets host1(config-policy-list)#color yellow classifier-group af22-packets host1(config-policy-list)#color red classifier-group af13-packets host1(config-policy-list)#color red classifier-group af23-packets

| Note: For a topology-driven LSP, you must configure and apply the classifier list and policy list manually.

The packets are forwarded to the appropriate fabric queue according to the traffic class/color combination. On a transit router, when the packet is forwarded out of the tunnel, the router-generated output policy then sets the EXP bits back according to the traffic class/color combination. Typically, the effect of the EXP bits to traffic class/color combination to EXP bits is no change.

On an egress router, where the tunnel terminates, no router-generated output policy is attached, and the packets pass out of the router subject to any manually configured IP policy management applied to their traffic class/color combination.

#### Related Documentation

- See the JunosE Policy Management Configuration Guide for more information about defining policies.
- Configuring MPLS and Differentiated Services
- Configuring EXP Bits for Differentiated Services
- Example Differentiated Services Application and Configuration
- Classifying Traffic for Differentiated Services
- mark-exp
- mpls classifier-list
- mpls diff-serv phb-id traffic-class
- mpls match exp-bits
- mpls match traffic-class
- mpls policy-list
- mpls policy-statistics
- mpls traffic-class
- tunnel mpls diff-serv phb-id