ON THIS PAGE
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.
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 172.16.2.0/24 orlonger;
}
then source-class gold1;
}
term gold2 {
from {
route-filter 172.16.3.0/24 orlonger;
}
then source-class gold2;
}
term gold3 {
from {
route-filter 172.16.4.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 172.16.5.0/24 orlonger;
}
then destination-class silver1;
}
term silver2 {
from {
route-filter 172.16.6.0/24 orlonger;
}
then destination-class silver2;
}
term silver3 {
from {
route-filter 172.16.7.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 #configuration715__scu-dcu-sample-st describes the steps on Device PE.
Configuration
Procedure
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/30 set interfaces lo0 unit 0 family inet address 192.168.0.1/32 set interfaces lo0 unit 0 family inet address 172.16.0.1/32 set interfaces lo0 unit 0 family inet address 172.16.0.1/32 set interfaces lo0 unit 0 family inet address 172.16.0.1/32 set interfaces lo0 unit 0 family inet address 172.16.0.1/32 set interfaces lo0 unit 0 family inet address 172.16.0.1/32 set interfaces lo0 unit 0 family inet address 172.16.0.1/32 set protocols bgp group ext type external set protocols bgp group ext export send-direct set protocols bgp group ext export send-static set protocols bgp group ext peer-as 200 set protocols bgp group ext neighbor 10.0.0.2 set policy-options policy-statement send-direct term 1 from protocol direct set policy-options policy-statement send-direct term 1 then accept set policy-options policy-statement send-static term 1 from protocol static set policy-options policy-statement send-static term 1 then accept set routing-options static route 10.1.0.0/30 next-hop 10.0.0.2 set routing-options autonomous-system 100
Device PE
set interfaces fe-1/2/0 unit 0 family inet accounting source-class-usage output set interfaces fe-1/2/0 unit 0 family inet address 10.0.0.2/30 set interfaces fe-1/2/1 unit 0 family inet accounting source-class-usage input set interfaces fe-1/2/1 unit 0 family inet accounting destination-class-usage set interfaces fe-1/2/1 unit 0 family inet address 10.1.0.1/30 set interfaces lo0 unit 0 family inet address 192.168.0.2/32 set protocols bgp group ext type external set protocols bgp group ext export send-direct set protocols bgp group ext neighbor 10.0.0.1 peer-as 100 set protocols bgp group ext neighbor 10.1.0.2 peer-as 300 set policy-options policy-statement dcu_class term silver1 from route-filter 172.16.5.0/24 orlonger set policy-options policy-statement dcu_class term silver1 then destination-class silver1 set policy-options policy-statement dcu_class term silver2 from route-filter 172.16.6.0/24 orlonger set policy-options policy-statement dcu_class term silver2 then destination-class silver2 set policy-options policy-statement dcu_class term silver3 from route-filter 172.16.7.0/24 orlonger set policy-options policy-statement dcu_class term silver3 then destination-class silver3 set policy-options policy-statement scu_class term gold1 from route-filter 172.16.2.0/24 orlonger set policy-options policy-statement scu_class term gold1 then source-class gold1 set policy-options policy-statement scu_class term gold2 from route-filter 172.16.3.0/24 orlonger set policy-options policy-statement scu_class term gold2 then source-class gold2 set policy-options policy-statement scu_class term gold3 from route-filter 172.16.4.0/24 orlonger set policy-options policy-statement scu_class term gold3 then source-class gold3 set policy-options policy-statement send-direct term 1 from protocol direct set policy-options policy-statement send-direct term 1 then accept set routing-options autonomous-system 200 set routing-options forwarding-table export dcu_class set routing-options forwarding-table export scu_class
Device P
set interfaces fe-1/2/1 unit 0 family inet address 10.1.0.2/30 set interfaces lo0 unit 0 family inet address 192.168.0.3/32 set interfaces lo0 unit 0 family inet address 172.16.0.3/32 set interfaces lo0 unit 0 family inet address 172.16.0.3/32 set interfaces lo0 unit 0 family inet address 172.16.0.3/32 set interfaces lo0 unit 0 family inet address 172.16.0.3/32 set interfaces lo0 unit 0 family inet address 172.16.0.3/32 set interfaces lo0 unit 0 family inet address 172.16.0.3/32 set protocols bgp group ext type external set protocols bgp group ext export send-direct set protocols bgp group ext export send-static set protocols bgp group ext peer-as 200 set protocols bgp group ext neighbor 10.1.0.1 set policy-options policy-statement send-direct term 1 from protocol direct set policy-options policy-statement send-direct term 1 then accept set policy-options policy-statement send-static term 1 from protocol static set policy-options policy-statement send-static term 1 then accept set routing-options static route 10.0.0.0/30 next-hop 10.1.0.1 set routing-options static route 172.16.2.0/24 discard set routing-options static route 172.16.3.0/24 discard set routing-options static route 172.16.4.0/24 discard set routing-options static route 172.16.5.0/24 discard set routing-options static route 172.16.6.0/24 discard set routing-options static route 172.16.7.0/24 discard set 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 Use the CLI Editor in Configuration Mode in the Junos OS CLI User Guide.
To group source and destination prefixes in a forwarding class:
Create the router interfaces.
[edit interfaces] user@PE# set fe-1/2/0 unit 0 family inet accounting source-class-usage output user@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 input user@PE# set fe-1/2/1 unit 0 family inet accounting destination-class-usage user@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
Configure BGP.
[edit protocols bgp group ext] user@PE# set type external user@PE# set export send-direct user@PE# set neighbor 10.0.0.1 peer-as 100 user@PE# set neighbor 10.1.0.2 peer-as 300
Configure the DCU policy.
[edit policy-options policy-statement dcu_class] user@PE# set term silver1 from route-filter 172.16.5.0/24 orlonger user@PE# set term silver1 then destination-class silver1 user@PE# set term silver2 from route-filter 172.16.6.0/24 orlonger user@PE# set term silver2 then destination-class silver2 user@PE# set term silver3 from route-filter 172.16.7.0/24 orlonger user@PE# set term silver3 then destination-class silver3
Configure the SCU policy.
[edit policy-options policy-statement scu_class] user@PE# set term gold1 from route-filter 172.16.2.0/24 orlonger user@PE# set term gold1 then source-class gold1 user@PE# set term gold2 from route-filter 172.16.3.0/24 orlonger user@PE# set term gold2 then source-class gold2 user@PE# set term gold3 from route-filter 172.16.4.0/24 orlonger user@PE# set term gold3 then source-class gold3
Apply the policies to the forwarding table.
[edit routing-options forwarding-table] user@PE# set export dcu_class user@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.
(Optional) Configure a routing policy that advertises direct routes.
[edit policy-options policy-statement send-direct term 1] user@PE# set from protocol direct user@PE# set then accept
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 172.16.5.0/24 orlonger; } then destination-class silver1; } term silver2 { from { route-filter 172.16.6.0/24 orlonger; } then destination-class silver2; } term silver3 { from { route-filter 172.16.7.0/24 orlonger; } then destination-class silver3; } } policy-statement scu_class { term gold1 { from { route-filter 172.16.2.0/24 orlonger; } then source-class gold1; } term gold2 { from { route-filter 172.16.3.0/24 orlonger; } then source-class gold2; } term gold3 { from { route-filter 172.16.4.0/24 orlonger; } then source-class gold3; } } policy-statement send-direct { term 1 { from protocol direct; then accept; } }
user@PE# show routing-options autonomous-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
From Device P, ping an address in the customer network.
user@P> ping rapid count 10000000 172.16.0.1 PING 172.16.0.1 (6.0.0.1): 56 data bytes !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
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
From Device CE, ping an address in the customer network.
user@CE> ping rapid count 10000000 172.16.0.1 PING 172.16.0.1 (6.0.0.1): 56 data bytes !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
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.