Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

Navigation

Example: Grouping Source and Destination Prefixes into a Forwarding Class

This example shows how to group source and destination prefixes into a forwarding class.

Requirements

No special configuration beyond device initialization is required before configuring this example.

Overview

This example uses three routing devices: a customer edge (CE) device, a provider edge (PE) device, and a provider core (P) device.

Figure 1 shows the sample network.

Figure 1: SCU and DCU Sample Network

SCU and DCU Sample Network

Source class usage (SCU) counts packets sent to the customer edge by performing lookup on the IP source address and the IP destination address. SCU makes it possible to track traffic originating from specific prefixes on the provider core and destined for specific prefixes on the customer edge.

DCU counts packets from customers by performing a lookup of the IP destination address. DCU makes it possible to track traffic originating from the customer edge and destined for specific prefixes on the provider core router.

On Device PE’s fe-1/2/1 interface, facing the provider core (represented by Device P), SCU input is configured with the source-class-usage input statement to track traffic originating at Device P and destined to Device CE. On this same interface, the destination-class-usage input statement is configured to track traffic originating at Device CE destined to the provider core.

user@PE# show interfaces fe-1/2/1 unit 0 family inet
accounting {source-class-usage {input; # tracks traffic destined to customer edge}destination-class-usage; # tracks traffic destined to provider core}
address 10.1.0.1/30;

Unlike destination class usage (DCU), which only requires implementation on a single interface, accounting for SCU must be enabled on two interfaces: the inbound and outbound interfaces traversed by the source class. You must define explicitly the two interfaces on which SCU monitored traffic is expected to arrive and depart. This is because SCU performs two lookups in the routing table: a source address (SA) and a destination address (DA) lookup. In contrast, DCU only has a single destination address lookup.

On Device PE’s fe-1/2/0 interface, facing Device CE, SCU output is configured with the source-class-usage output statement.

user@PE# show interfaces fe-1/2/0 unit 0 family inet
accounting {source-class-usage {output;}}
address 10.0.0.2/30;

To account for traffic destined to the customer, the policy called scu_class uses route filters to place traffic into the gold1, gold2, and gold3 classes.

user@PE# show policy-options
policy-statement scu_class {term gold1 {from {route-filter 2.0.0.0/24 orlonger;}then source-class gold1;}term gold2 {from {route-filter 3.0.0.0/24 orlonger;}then source-class gold2;}term gold3 {from {route-filter 4.0.0.0/24 orlonger;}then source-class gold3;}}

To account for traffic destined to the provider, the policy called dcu_class uses route filters to place traffic into the silver1, silver2, and silver3 classes.

user@PE# show policy-options
policy-statement dcu_class {term silver1 {from {route-filter 5.0.0.0/24 orlonger;}then destination-class silver1;}term silver2 {from {route-filter 6.0.0.0/24 orlonger;}then destination-class silver2;}term silver3 {from {route-filter 7.0.0.0/24 orlonger;}then destination-class silver3;}}

The policies are then applied to the forwarding table.

forwarding-table {export [ dcu_class scu_class ];}

The example uses static routes to provide connectivity and loopback interface addresses for testing the operation.

CLI Quick Configuration shows the configuration for all of the devices in Figure 1.

The section Step-by-Step Procedure describes the steps on Device PE.

Configuration

CLI Quick Configuration

To quickly configure this example, copy the following commands, paste them into a text file, remove any line breaks, change any details necessary to match your network configuration, and then copy and paste the commands into the CLI at the [edit] hierarchy level.

Device CE

set interfaces fe-1/2/0 unit 0 family inet address 10.0.0.1/30set interfaces lo0 unit 0 family inet address 192.168.0.1/32set interfaces lo0 unit 0 family inet address 2.0.0.1/32set interfaces lo0 unit 0 family inet address 3.0.0.1/32set interfaces lo0 unit 0 family inet address 4.0.0.1/32set interfaces lo0 unit 0 family inet address 5.0.0.1/32set interfaces lo0 unit 0 family inet address 6.0.0.1/32set interfaces lo0 unit 0 family inet address 7.0.0.1/32set protocols bgp group ext type externalset protocols bgp group ext export send-directset protocols bgp group ext export send-staticset protocols bgp group ext peer-as 200set protocols bgp group ext neighbor 10.0.0.2set policy-options policy-statement send-direct term 1 from protocol directset policy-options policy-statement send-direct term 1 then acceptset policy-options policy-statement send-static term 1 from protocol staticset policy-options policy-statement send-static term 1 then acceptset routing-options static route 10.1.0.0/30 next-hop 10.0.0.2set routing-options autonomous-system 100

Device PE

set interfaces fe-1/2/0 unit 0 family inet accounting source-class-usage outputset interfaces fe-1/2/0 unit 0 family inet address 10.0.0.2/30set interfaces fe-1/2/1 unit 0 family inet accounting source-class-usage inputset interfaces fe-1/2/1 unit 0 family inet accounting destination-class-usageset interfaces fe-1/2/1 unit 0 family inet address 10.1.0.1/30set interfaces lo0 unit 0 family inet address 192.168.0.2/32set protocols bgp group ext type externalset protocols bgp group ext export send-directset protocols bgp group ext neighbor 10.0.0.1 peer-as 100set protocols bgp group ext neighbor 10.1.0.2 peer-as 300set policy-options policy-statement dcu_class term silver1 from route-filter 5.0.0.0/24 orlongerset policy-options policy-statement dcu_class term silver1 then destination-class silver1set policy-options policy-statement dcu_class term silver2 from route-filter 6.0.0.0/24 orlongerset policy-options policy-statement dcu_class term silver2 then destination-class silver2set policy-options policy-statement dcu_class term silver3 from route-filter 7.0.0.0/24 orlongerset policy-options policy-statement dcu_class term silver3 then destination-class silver3set policy-options policy-statement scu_class term gold1 from route-filter 2.0.0.0/24 orlongerset policy-options policy-statement scu_class term gold1 then source-class gold1set policy-options policy-statement scu_class term gold2 from route-filter 3.0.0.0/24 orlongerset policy-options policy-statement scu_class term gold2 then source-class gold2set policy-options policy-statement scu_class term gold3 from route-filter 4.0.0.0/24 orlongerset policy-options policy-statement scu_class term gold3 then source-class gold3set policy-options policy-statement send-direct term 1 from protocol directset policy-options policy-statement send-direct term 1 then acceptset routing-options autonomous-system 200set routing-options forwarding-table export dcu_classset routing-options forwarding-table export scu_class

Device P

set interfaces fe-1/2/1 unit 0 family inet address 10.1.0.2/30set interfaces lo0 unit 0 family inet address 192.168.0.3/32set interfaces lo0 unit 0 family inet address 2.0.0.3/32set interfaces lo0 unit 0 family inet address 3.0.0.3/32set interfaces lo0 unit 0 family inet address 4.0.0.3/32set interfaces lo0 unit 0 family inet address 5.0.0.3/32set interfaces lo0 unit 0 family inet address 6.0.0.3/32set interfaces lo0 unit 0 family inet address 7.0.0.3/32set protocols bgp group ext type externalset protocols bgp group ext export send-directset protocols bgp group ext export send-staticset protocols bgp group ext peer-as 200set protocols bgp group ext neighbor 10.1.0.1set policy-options policy-statement send-direct term 1 from protocol directset policy-options policy-statement send-direct term 1 then acceptset policy-options policy-statement send-static term 1 from protocol staticset policy-options policy-statement send-static term 1 then acceptset routing-options static route 10.0.0.0/30 next-hop 10.1.0.1set routing-options static route 2.0.0.0/24 discardset routing-options static route 3.0.0.0/24 discardset routing-options static route 4.0.0.0/24 discardset routing-options static route 5.0.0.0/24 discardset routing-options static route 6.0.0.0/24 discardset routing-options static route 7.0.0.0/24 discardset routing-options autonomous-system 300

Step-by-Step Procedure

The following example requires you to navigate various levels in the configuration hierarchy. For instructions on how to do that, see Using the CLI Editor in Configuration Mode in the CLI User Guide.

To group source and destination prefixes in a forwarding class:

  1. Create the router interfaces.

    [edit interfaces]user@PE# set fe-1/2/0 unit 0 family inet accounting source-class-usage outputuser@PE# set fe-1/2/0 unit 0 family inet address 10.0.0.2/30
    user@PE# set fe-1/2/1 unit 0 family inet accounting source-class-usage inputuser@PE# set fe-1/2/1 unit 0 family inet accounting destination-class-usageuser@PE# set fe-1/2/1 unit 0 family inet address 10.1.0.1/30
    user@PE# set lo0 unit 0 family inet address 192.168.0.2/32
  2. Configure BGP.

    [edit protocols bgp group ext]user@PE# set type externaluser@PE# set export send-directuser@PE# set neighbor 10.0.0.1 peer-as 100user@PE# set neighbor 10.1.0.2 peer-as 300
  3. Configure the DCU policy.

    [edit policy-options policy-statement dcu_class]user@PE# set term silver1 from route-filter 5.0.0.0/24 orlongeruser@PE# set term silver1 then destination-class silver1
    user@PE# set term silver2 from route-filter 6.0.0.0/24 orlongeruser@PE# set term silver2 then destination-class silver2
    user@PE# set term silver3 from route-filter 7.0.0.0/24 orlongeruser@PE# set term silver3 then destination-class silver3
  4. Configure the SCU policy.

    [edit policy-options policy-statement scu_class]user@PE# set term gold1 from route-filter 2.0.0.0/24 orlongeruser@PE# set term gold1 then source-class gold1
    user@PE# set term gold2 from route-filter 3.0.0.0/24 orlongeruser@PE# set term gold2 then source-class gold2
    user@PE# set term gold3 from route-filter 4.0.0.0/24 orlongeruser@PE# set term gold3 then source-class gold3
  5. Apply the policies to the forwarding table.

    [edit routing-options forwarding-table]user@PE# set export dcu_classuser@PE# set export scu_class

    Note: You can refer to the same routing policy one or more times in the same or different export statement.

  6. (Optional) Configure a routing policy that advertises direct routes.
    [edit policy-options policy-statement send-direct term 1]user@PE# set from protocol directuser@PE# set then accept
  7. Configure the autonomous system (AS) number.
    [edit routing-options]user@PE# set autonomous-system 200

Results

From configuration mode, confirm your configuration by issuing the show interfaces, show protocols, show policy-options, and show routing-options commands. If the output does not display the intended configuration, repeat the instructions in this example to correct the configuration.

user@PE# show interfaces
fe-1/2/0 {unit 0 {family inet {accounting {source-class-usage {output;}}address 10.0.0.2/30;}}}
fe-1/2/1 {unit 0 {family inet {accounting {source-class-usage {input;}destination-class-usage;}address 10.1.0.1/30;}}}
lo0 {unit 0 {family inet {address 192.168.0.2/32;}}}
user@PE# show protocols
bgp {group ext {type external;export send-direct;neighbor 10.0.0.1 {peer-as 100;}neighbor 10.1.0.2 {peer-as 300;}}}
user@PE# show policy-options
policy-statement dcu_class {term silver1 {from {route-filter 5.0.0.0/24 orlonger;}then destination-class silver1;}term silver2 {from {route-filter 6.0.0.0/24 orlonger;}then destination-class silver2;}term silver3 {from {route-filter 7.0.0.0/24 orlonger;}then destination-class silver3;}}
policy-statement scu_class {term gold1 {from {route-filter 2.0.0.0/24 orlonger;}then source-class gold1;}term gold2 {from {route-filter 3.0.0.0/24 orlonger;}then source-class gold2;}term gold3 {from {route-filter 4.0.0.0/24 orlonger;}then source-class gold3;}}
policy-statement send-direct {term 1 {from protocol direct;then accept;}}
user@PE# show routing-optionsautonomous-system 200;
forwarding-table {export [ dcu_class scu_class ];}

If you are done configuring the device, enter commit from configuration mode.

Verification

Confirm that the configuration is working properly.

Making Sure That the DCU Policy Is Working

Purpose

Verify that traffic sent from the provider core into the customer network is causing the DCU policy counters to increment.

Action

  1. From Device P, ping an address in the customer network.
    user@P> ping rapid count 10000000 6.0.0.1
    PING 6.0.0.1 (6.0.0.1): 56 data bytes
    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!...
  2. On Device PE, check the interface statistics on the interface facing the provider core.
    user@PE> show interfaces statistics fe-1/2/1.0
      Logical interface fe-1/2/1.0 (Index 108) (SNMP ifIndex 546) 
        Flags: SNMP-Traps 0x4000 Encapsulation: ENET2
        Input packets : 251956
        Output packets: 251961
        Protocol inet, MTU: 1500
          Flags: Sendbcast-pkt-to-re, DCU, SCU-in
                                                   Packets                Bytes
          Destination class            (packet-per-second)    (bits-per-second)
    
                              silver1                 7460               626640
                                      (                  0) (                 0)
                              silver2                22440              2401416
                                      (                256) (            171963)
                              silver3                 9004               756336
                                      (                  0) (                 0)
          Addresses, Flags: Is-Preferred Is-Primary
            Destination: 10.1.0.0/30, Local: 10.1.0.1, Broadcast: 10.1.0.3
    

Meaning

Packet and bit rates are displayed with packet and byte counters.

Alternatively, you can use the show interfaces destination-class all command to display the same information.

Making Sure That the SCU Policy Is Working

Purpose

Verify that traffic sent from the customer network into the provider core is causing the SCU policy counters to increment.

Action

  1. From Device CE, ping an address in the customer network.
    user@CE> ping rapid count 10000000 2.0.0.1
    PING 6.0.0.1 (6.0.0.1): 56 data bytes
    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!...
  2. On Device PE, check the interface statistics on the interface facing the customer network.
    user@PE> show interfaces statistics fe-1/2/0.0
      Logical interface fe-1/2/0.0 (Index 93) (SNMP ifIndex 554) 
        Flags: SNMP-Traps 0x4000 Encapsulation: ENET2
        Input packets : 32246
        Output packets: 32245
        Protocol inet, MTU: 1500
          Flags: Sendbcast-pkt-to-re, Is-Primary, SCU-out
                                                   Packets                Bytes
          Source class                 (packet-per-second)    (bits-per-second)
    
                                gold1                 8871               745164
                                      (                259) (            174497)
                                gold2                 1812               152208
                                      (                  0) (                 0)
                                gold3                 5711               479724
                                      (                  0) (                 0)
          Addresses, Flags: Is-Preferred Is-Primary
            Destination: 10.0.0.0/30, Local: 10.0.0.2, Broadcast: 10.0.0.3
    

Meaning

Packet and bit rates are displayed with packet and byte counters.

Alternatively, you can use the show interfaces source-class all command to display the same information.

Published: 2013-09-17