Viewing Ingress CoS Markings on a Juniper JUNOS MX Series Router

Introduction

When troubleshooting CoS related problems or testing CoS features it is often useful to be able to view the class of service of packets as they enter your router. If packets are not entering your router with the correct markings they will not be assigned to the correct forwarding class and will not receive the desired CoS treatment. Oddly, there does not seem to be a JUNOS command that displays counters of ingress markings. One way around this is to use an inbound firewall filter that matches and counts ingress packets based on their markings.

Junos Configuration

To configure this feature you have to configure the right type of firewall filter for the packest you want to count and for the encapsulation of the ingress interface you want to count them on.

Following are two examples, the first for PCP bits (802.1p bits in a VLAN header) and second EXP bits (CoS bits in an MPLS header). Both examples assume you have already configured the appropriate schedulers, and scheduler-map for the interface. The first example matches on forwarding class and therefore assumes you have non-default forwarding classes configured:

forwarding-classes {
queue 0 Network priority high;
queue 1 Gold priority high;
queue 2 Silver priority low;
queue 3 Bronze priority low;
queue 4 BestEffort priority low;

The second example matches on bit pattern alias and therefore assumes you have configured a code point alias map for the EXP bits:

code-point-aliases {
exp {
exp0 000;
exp1 001;
exp2 010;
exp3 011;
exp4 100;
exp5 101;
exp6 110;
exp7 111;

Viewing PCP on an interface using “vlan-bridge” encapsulation.

Configure the filter

set firewall family any filter incoming_class term Network from forwarding-class Network

set firewall family any filter incoming_class term Network then count Network

set firewall family any filter incoming_class term Gold from forwarding-class Gold

set firewall family any filter incoming_class term Gold then count Gold

set firewall family any filter incoming_class term Silver from forwarding-class Silver

set firewall family any filter incoming_class term Silver then count Silver

set firewall family any filter incoming_class term Bronze from forwarding-class Bronze

set firewall family any filter incoming_class term Bronze then count Bronze

set firewall family any filter incoming_class term BestEffort from forwarding-class BestEffort

set firewall family any filter incoming_class term BestEffort then count BestEffort

set firewall family any filter incoming_class term accept then accept

Apply to the appropriate interface

 

set interfaces xx-x/x/x unit xxx filter input incoming_class

 

Clear counters

 

clear firewall filter incoming_class

 

Viewing Counters

 

user@router_name> show firewall filter incoming_class




Filter: incoming_class

Counters:

Name                                                Bytes              Packets

BestEffort                                                      0                    0

Silver                                                     0                    0

Network                                                  46436                  684

Gold                                             1771637284              9133411

Bronze                                                      0                    0

Viewing EXP on an interface using “Ethernet” encapsulation

Configure the filter

 

set firewall family mpls filter incoming_exp term 7 from exp 7

set firewall family mpls filter incoming_exp term 7 then count exp7

set firewall family mpls filter incoming_exp term 6 from exp 6

set firewall family mpls filter incoming_exp term 6 then count exp6

set firewall family mpls filter incoming_exp term 5 from exp 5

set firewall family mpls filter incoming_exp term 5 then count exp5

set firewall family mpls filter incoming_exp term 4 from exp 4

set firewall family mpls filter incoming_exp term 4 then count exp4

set firewall family mpls filter incoming_exp term 3 from exp 3

set firewall family mpls filter incoming_exp term 3 then count exp3

set firewall family mpls filter incoming_exp term 2 from exp 2

set firewall family mpls filter incoming_exp term 2 then count exp2

set firewall family mpls filter incoming_exp term 1 from exp 1

set firewall family mpls filter incoming_exp term 1 then count exp1

set firewall family mpls filter incoming_exp term 0 from exp 0

set firewall family mpls filter incoming_exp term 0 then count exp0

set firewall family mpls filter incoming_exp term accept then accept

Apply to the appropriate interface

 

set interfaces xx-x/x/x unit 0 family mpls filter input incoming_exp

 

Clear counters

 

clear firewall filter incoming_exp

View counters

 

user@router_name> show firewall filter incoming_exp




Filter: incoming_exp

Counters:

Name                                                Bytes              Packets

exp0                                              6292252                 6192

exp1                                              8591442                13403

exp2                                                    0                    0

exp3                                                19965                  175

exp4                                                    0                    0

exp5                                              2596646                11741

exp6                                                    0                    0

exp7                                                 3132                   22

Leave a Reply

Your email address will not be published. Required fields are marked *