Vlan Preclassification
The following scenario shows how to pre-classify packets using traffic policies. This reduces packet processing time and improves system performance.
Test VLAN Pre-Classify Out (802.1Q)
Description
A traffic policy is configured in DUT0 (interface
eth0). This policy enables vlan
pre-classification in the link-out hook; i.e., all
packets leaving this interface are processed.
Traffic policy is responsible of setting the class Id
for traffic control in egress. Traffic selector filter
based on ethernet protocol (802.1Q) and VLAN Id (100).
Scenario
Step 1: Set the following configuration in DUT0 :
set interfaces ethernet eth0 mtu 1390 set interfaces ethernet eth0 traffic control out HTB set interfaces ethernet eth0 traffic policy link-out CLASSIFIER set interfaces ethernet eth0 vif 100 address 10.0.0.1/24 set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0' set traffic control HTB type htb bandwidth 100 set traffic control HTB type htb class 1 bandwidth percentage 100 set traffic control HTB type htb class 2 bandwidth percentage 10 set traffic control HTB type htb default-class 2 set traffic policy CLASSIFIER rule 1 selector VLAN set traffic policy CLASSIFIER rule 1 set class 1 set traffic selector VLAN rule 1 ether-type 8021q set traffic selector VLAN rule 1 vlan id 100
Step 2: Set the following configuration in DUT1 :
set interfaces ethernet eth0 mtu 1390 set interfaces ethernet eth0 vif 100 address 10.0.0.2/24 set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'
Step 3: Ping the IP address 10.0.0.2 from DUT0:
admin@DUT0$ ping 10.0.0.2 count 1 size 56 timeout 1Show output
PING 10.0.0.2 (10.0.0.2) 56(84) bytes of data. 64 bytes from 10.0.0.2: icmp_seq=1 ttl=64 time=0.860 ms --- 10.0.0.2 ping statistics --- 1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 0.860/0.860/0.860/0.000 ms
Step 4: Run the command traffic control clear on DUT0 and expect no output.
Step 5: Initiate a bandwidth test from DUT0 to DUT1
admin@DUT1$ monitor test performance server port 5001 admin@DUT0$ monitor test performance client 10.0.0.2 duration 5 port 5001 parallel 1Expect the following output on
DUT0:Connecting to host 10.0.0.2, port 5001 [ 5] local 10.0.0.1 port 59822 connected to 10.0.0.2 port 5001 [ ID] Interval Transfer Bitrate Retr Cwnd [ 5] 0.00-1.00 sec 13.4 MBytes 113 Mbits/sec 155 82.3 KBytes [ 5] 1.00-2.00 sec 11.4 MBytes 95.6 Mbits/sec 45 96.7 KBytes [ 5] 2.00-3.00 sec 11.3 MBytes 95.1 Mbits/sec 83 84.9 KBytes [ 5] 3.00-4.00 sec 11.4 MBytes 95.6 Mbits/sec 82 83.6 KBytes [ 5] 4.00-5.00 sec 11.4 MBytes 95.6 Mbits/sec 80 77.1 KBytes - - - - - - - - - - - - - - - - - - - - - - - - - [ ID] Interval Transfer Bitrate Retr [ 5] 0.00-5.00 sec 58.9 MBytes 98.9 Mbits/sec 445 sender [ 5] 0.00-5.00 sec 58.2 MBytes 97.6 Mbits/sec receiver iperf Done.
Step 6: Run the command traffic control show on DUT0 and check whether the output matches the following regular expressions:
class 1\s+1:0\s+\d+\s+[1-9]\d{3,} class 2 \(default\)\s+1:0\s+\d+\s+\d{1,2}\sShow output
Traffic control for interface 'eth0' - 'egress' mode ------------------------------------------------------------------------------------ ID traffic control type parent bytes sent pkts sent pkts dropped ------------------------------------------------------------------------------------ 1:0 HTB htb root 64142622 45708 15 1:1 HTB class 1 1:0 64142382 45706 0 1:2 HTB class 2 (default) 1:0 240 2 0 2:0 - htb 1:1 64142382 45706 15 3:0 - htb 1:2 240 2 0
Step 7: Modify the following configuration lines in DUT0 :
delete interfaces ethernet eth0 vif 100 set interfaces ethernet eth0 vif 101 address 10.0.0.1/24
Step 8: Modify the following configuration lines in DUT1 :
delete interfaces ethernet eth0 vif 100 set interfaces ethernet eth0 vif 101 address 10.0.0.2/24
Step 9: Run the command traffic control clear on DUT0 and expect no output.
Step 10: Initiate a bandwidth test from DUT0 to DUT1
admin@DUT1$ monitor test performance server port 5001 admin@DUT0$ monitor test performance client 10.0.0.2 duration 5 port 5001 parallel 1Expect the following output on
DUT0:Connecting to host 10.0.0.2, port 5001 [ 5] local 10.0.0.1 port 51698 connected to 10.0.0.2 port 5001 [ ID] Interval Transfer Bitrate Retr Cwnd [ 5] 0.00-1.00 sec 1.59 MBytes 13.3 Mbits/sec 87 13.1 KBytes [ 5] 1.00-2.00 sec 1.10 MBytes 9.25 Mbits/sec 43 15.7 KBytes [ 5] 2.00-3.00 sec 1.10 MBytes 9.25 Mbits/sec 45 15.7 KBytes [ 5] 3.00-4.00 sec 1.16 MBytes 9.76 Mbits/sec 38 15.7 KBytes [ 5] 4.00-5.00 sec 1.10 MBytes 9.25 Mbits/sec 43 11.8 KBytes - - - - - - - - - - - - - - - - - - - - - - - - - [ ID] Interval Transfer Bitrate Retr [ 5] 0.00-5.00 sec 6.06 MBytes 10.2 Mbits/sec 256 sender [ 5] 0.00-5.00 sec 5.82 MBytes 9.77 Mbits/sec receiver iperf Done.
Step 11: Run the command traffic control show on DUT0 and check whether the output matches the following regular expressions:
class 1\s+1:0\s+\d+\s+\d{1,2}\s class 2 \(default\)\s+1:0\s+\d+\s+[1-9]\d{3,}Show output
Traffic control for interface 'eth0' - 'egress' mode ------------------------------------------------------------------------------------ ID traffic control type parent bytes sent pkts sent pkts dropped ------------------------------------------------------------------------------------ 1:0 HTB htb root 6417769 4593 46 1:1 HTB class 1 1:0 0 0 0 1:2 HTB class 2 (default) 1:0 6417769 4593 0 2:0 - htb 1:1 0 0 0 3:0 - htb 1:2 6417769 4593 46
Test VLAN Pre-Classify Out (QinQ)
Description
A traffic policy is configured in DUT0 (interface
eth0). This policy enables vlan
pre-classification in the link-out hook; i.e., all
packets leaving this interface are processed.
Traffic policy is responsible of setting the class Id
for traffic control in egress. Traffic selector filter
based on QinQ (802.1ad over 802.1Q), VLAN Id (100) and
C-VLAN Id (200)
Scenario
Step 1: Set the following configuration in DUT0 :
set interfaces ethernet eth0 mtu 1390 set interfaces ethernet eth0 traffic control out HTB set interfaces ethernet eth0 traffic policy link-out CLASSIFIER set interfaces ethernet eth0 vif 100 ethertype 802.1ad set interfaces ethernet eth0 vif 100 vif-c 200 address 10.0.0.1/24 set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0' set traffic control HTB type htb bandwidth 100 set traffic control HTB type htb class 1 bandwidth percentage 100 set traffic control HTB type htb class 2 bandwidth percentage 10 set traffic control HTB type htb default-class 2 set traffic policy CLASSIFIER rule 1 selector VLAN set traffic policy CLASSIFIER rule 1 set class 1 set traffic selector VLAN rule 1 ether-type 8021ad set traffic selector VLAN rule 1 vlan id 100 set traffic selector VLAN rule 1 vlan inner-id 200 set traffic selector VLAN rule 1 vlan protocol 8021q
Step 2: Set the following configuration in DUT1 :
set interfaces ethernet eth0 mtu 1390 set interfaces ethernet eth0 vif 100 ethertype 802.1ad set interfaces ethernet eth0 vif 100 vif-c 200 address 10.0.0.2/24 set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'
Step 3: Ping the IP address 10.0.0.2 from DUT0:
admin@DUT0$ ping 10.0.0.2 count 1 size 56 timeout 1Show output
PING 10.0.0.2 (10.0.0.2) 56(84) bytes of data. 64 bytes from 10.0.0.2: icmp_seq=1 ttl=64 time=0.836 ms --- 10.0.0.2 ping statistics --- 1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 0.836/0.836/0.836/0.000 ms
Step 4: Run the command traffic control clear on DUT0 and expect no output.
Step 5: Initiate a bandwidth test from DUT0 to DUT1
admin@DUT1$ monitor test performance server port 5001 admin@DUT0$ monitor test performance client 10.0.0.2 duration 5 port 5001 parallel 1Expect the following output on
DUT0:Connecting to host 10.0.0.2, port 5001 [ 5] local 10.0.0.1 port 56116 connected to 10.0.0.2 port 5001 [ ID] Interval Transfer Bitrate Retr Cwnd [ 5] 0.00-1.00 sec 13.4 MBytes 113 Mbits/sec 168 65.3 KBytes [ 5] 1.00-2.00 sec 11.3 MBytes 95.1 Mbits/sec 83 65.3 KBytes [ 5] 2.00-3.00 sec 11.3 MBytes 94.5 Mbits/sec 46 98.0 KBytes [ 5] 3.00-4.00 sec 11.4 MBytes 95.6 Mbits/sec 82 84.9 KBytes [ 5] 4.00-5.00 sec 11.3 MBytes 95.1 Mbits/sec 95 45.7 KBytes - - - - - - - - - - - - - - - - - - - - - - - - - [ ID] Interval Transfer Bitrate Retr [ 5] 0.00-5.00 sec 58.7 MBytes 98.6 Mbits/sec 474 sender [ 5] 0.00-5.00 sec 58.1 MBytes 97.4 Mbits/sec receiver iperf Done.
Step 6: Run the command traffic control show on DUT0 and check whether the output matches the following regular expressions:
class 1\s+1:0\s+\d+\s+[1-9]\d{3,} class 2 \(default\)\s+1:0\s+\d+\s+\d{1,2}\sShow output
Traffic control for interface 'eth0' - 'egress' mode ------------------------------------------------------------------------------------ ID traffic control type parent bytes sent pkts sent pkts dropped ------------------------------------------------------------------------------------ 1:0 HTB htb root 64130561 45571 17 1:1 HTB class 1 1:0 64130191 45568 0 1:2 HTB class 2 (default) 1:0 370 3 0 2:0 - htb 1:1 64130191 45568 17 3:0 - htb 1:2 370 3 0
Step 7: Modify the following configuration lines in DUT0 :
delete interfaces ethernet eth0 vif 100 vif-c 200 set interfaces ethernet eth0 vif 100 vif-c 201 address 10.0.0.1/24
Step 8: Modify the following configuration lines in DUT1 :
delete interfaces ethernet eth0 vif 100 vif-c 200 set interfaces ethernet eth0 vif 100 vif-c 201 address 10.0.0.2/24
Step 9: Run the command traffic control clear on DUT0 and expect no output.
Step 10: Initiate a bandwidth test from DUT0 to DUT1
admin@DUT1$ monitor test performance server port 5001 admin@DUT0$ monitor test performance client 10.0.0.2 duration 5 port 5001 parallel 1Expect the following output on
DUT0:Connecting to host 10.0.0.2, port 5001 [ 5] local 10.0.0.1 port 56130 connected to 10.0.0.2 port 5001 [ ID] Interval Transfer Bitrate Retr Cwnd [ 5] 0.00-1.00 sec 1.49 MBytes 12.5 Mbits/sec 88 11.8 KBytes [ 5] 1.00-2.00 sec 1.22 MBytes 10.3 Mbits/sec 34 6.53 KBytes [ 5] 2.00-3.00 sec 1.10 MBytes 9.25 Mbits/sec 26 9.15 KBytes [ 5] 3.00-4.00 sec 1.10 MBytes 9.25 Mbits/sec 27 9.15 KBytes [ 5] 4.00-5.00 sec 1.10 MBytes 9.25 Mbits/sec 42 11.8 KBytes - - - - - - - - - - - - - - - - - - - - - - - - - [ ID] Interval Transfer Bitrate Retr [ 5] 0.00-5.00 sec 6.03 MBytes 10.1 Mbits/sec 217 sender [ 5] 0.00-5.00 sec 5.81 MBytes 9.74 Mbits/sec receiver iperf Done.
Step 11: Run the command traffic control show on DUT0 and check whether the output matches the following regular expressions:
class 1\s+1:0\s+\d+\s+\d{1,2}\s class 2 \(default\)\s+1:0\s+\d+\s+[1-9]\d{3,}Show output
Traffic control for interface 'eth0' - 'egress' mode ------------------------------------------------------------------------------------ ID traffic control type parent bytes sent pkts sent pkts dropped ------------------------------------------------------------------------------------ 1:0 HTB htb root 6422948 4586 43 1:1 HTB class 1 1:0 0 0 0 1:2 HTB class 2 (default) 1:0 6422948 4586 0 2:0 - htb 1:1 0 0 0 3:0 - htb 1:2 6422948 4586 43
Test VLAN Pre-Classify Out (QinQ) with PCP matches
Description
A traffic policy is configured in DUT0 (interface
eth0). This policy enables vlan
pre-classification in the link-out hook; i.e., all
packets leaving this interface are processed.
Traffic policy is responsible of setting the class Id
for traffic control in egress. Traffic selector filter
based on QinQ (802.1ad over 802.1Q), VLAN Id (100),
VLAN PCP (3), C-VLAN Id (200) and C-VLAN PCP (5).
Scenario
Step 1: Set the following configuration in DUT0 :
set interfaces ethernet eth0 mtu 1390 set interfaces ethernet eth0 traffic control out HTB set interfaces ethernet eth0 traffic policy link-out CLASSIFIER set interfaces ethernet eth0 vif 100 ethertype 802.1ad set interfaces ethernet eth0 vif 100 traffic policy link-out OUTER_COS set interfaces ethernet eth0 vif 100 vif-c 200 address 10.0.0.1/24 set interfaces ethernet eth0 vif 100 vif-c 200 traffic policy link-out INNER_COS set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0' set traffic control HTB type htb bandwidth 100 set traffic control HTB type htb class 1 bandwidth percentage 100 set traffic control HTB type htb class 2 bandwidth percentage 10 set traffic control HTB type htb default-class 2 set traffic policy CLASSIFIER rule 1 selector VLAN set traffic policy CLASSIFIER rule 1 set class 1 set traffic policy INNER_COS rule 1 set cos-mark 5 set traffic policy OUTER_COS rule 1 set cos-mark 3 set traffic selector VLAN rule 1 ether-type 8021ad set traffic selector VLAN rule 1 vlan id 100 set traffic selector VLAN rule 1 vlan inner-id 200 set traffic selector VLAN rule 1 vlan inner-pcp 5 set traffic selector VLAN rule 1 vlan pcp 3 set traffic selector VLAN rule 1 vlan protocol 8021q
Step 2: Set the following configuration in DUT1 :
set interfaces ethernet eth0 mtu 1390 set interfaces ethernet eth0 vif 100 ethertype 802.1ad set interfaces ethernet eth0 vif 100 vif-c 200 address 10.0.0.2/24 set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'
Step 3: Ping the IP address 10.0.0.2 from DUT0:
admin@DUT0$ ping 10.0.0.2 count 1 size 56 timeout 1Show output
PING 10.0.0.2 (10.0.0.2) 56(84) bytes of data. 64 bytes from 10.0.0.2: icmp_seq=1 ttl=64 time=0.462 ms --- 10.0.0.2 ping statistics --- 1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 0.462/0.462/0.462/0.000 ms
Step 4: Run the command traffic control clear on DUT0 and expect no output.
Step 5: Initiate a bandwidth test from DUT0 to DUT1
admin@DUT1$ monitor test performance server port 5001 admin@DUT0$ monitor test performance client 10.0.0.2 duration 5 port 5001 parallel 1Expect the following output on
DUT0:Connecting to host 10.0.0.2, port 5001 [ 5] local 10.0.0.1 port 46556 connected to 10.0.0.2 port 5001 [ ID] Interval Transfer Bitrate Retr Cwnd [ 5] 0.00-1.00 sec 13.4 MBytes 112 Mbits/sec 175 86.2 KBytes [ 5] 1.00-2.00 sec 11.5 MBytes 96.6 Mbits/sec 64 86.2 KBytes [ 5] 2.00-3.00 sec 11.2 MBytes 94.0 Mbits/sec 86 83.6 KBytes [ 5] 3.00-4.00 sec 11.3 MBytes 94.5 Mbits/sec 75 70.6 KBytes [ 5] 4.00-5.00 sec 11.3 MBytes 94.5 Mbits/sec 69 65.3 KBytes - - - - - - - - - - - - - - - - - - - - - - - - - [ ID] Interval Transfer Bitrate Retr [ 5] 0.00-5.00 sec 58.6 MBytes 98.4 Mbits/sec 469 sender [ 5] 0.00-5.00 sec 58.0 MBytes 97.3 Mbits/sec receiver iperf Done.
Step 6: Run the command traffic control show on DUT0 and check whether the output matches the following regular expressions:
class 1\s+1:0\s+\d+\s+[1-9]\d{3,} class 2 \(default\)\s+1:0\s+\d+\s+\d{1,2}\sShow output
Traffic control for interface 'eth0' - 'egress' mode ------------------------------------------------------------------------------------ ID traffic control type parent bytes sent pkts sent pkts dropped ------------------------------------------------------------------------------------ 1:0 HTB htb root 64121959 45564 17 1:1 HTB class 1 1:0 64121739 45562 0 1:2 HTB class 2 (default) 1:0 220 2 0 2:0 - htb 1:1 64121739 45562 17 3:0 - htb 1:2 220 2 0
Step 7: Modify the following configuration lines in DUT0 :
delete interfaces ethernet eth0 vif 100 vif-c 200 address set interfaces ethernet eth0 vif 100 vif-c 201 address 10.0.0.1/24
Step 8: Modify the following configuration lines in DUT1 :
delete interfaces ethernet eth0 vif 100 vif-c 200 set interfaces ethernet eth0 vif 100 vif-c 201 address 10.0.0.2/24
Step 9: Run the command traffic control clear on DUT0 and expect no output.
Step 10: Initiate a bandwidth test from DUT0 to DUT1
admin@DUT1$ monitor test performance server port 5001 admin@DUT0$ monitor test performance client 10.0.0.2 duration 5 port 5001 parallel 1Expect the following output on
DUT0:Connecting to host 10.0.0.2, port 5001 [ 5] local 10.0.0.1 port 56626 connected to 10.0.0.2 port 5001 [ ID] Interval Transfer Bitrate Retr Cwnd [ 5] 0.00-1.00 sec 1.72 MBytes 14.4 Mbits/sec 98 11.8 KBytes [ 5] 1.00-2.00 sec 1.10 MBytes 9.25 Mbits/sec 28 11.8 KBytes [ 5] 2.00-3.00 sec 1.10 MBytes 9.25 Mbits/sec 34 9.15 KBytes [ 5] 3.00-4.00 sec 1.10 MBytes 9.25 Mbits/sec 29 10.5 KBytes [ 5] 4.00-5.00 sec 1.10 MBytes 9.25 Mbits/sec 34 9.15 KBytes - - - - - - - - - - - - - - - - - - - - - - - - - [ ID] Interval Transfer Bitrate Retr [ 5] 0.00-5.00 sec 6.13 MBytes 10.3 Mbits/sec 223 sender [ 5] 0.00-5.00 sec 5.81 MBytes 9.74 Mbits/sec receiver iperf Done.
Step 11: Run the command traffic control show on DUT0 and check whether the output matches the following regular expressions:
class 1\s+1:0\s+\d+\s+\d{1,2}\s class 2 \(default\)\s+1:0\s+\d+\s+[1-9]\d{3,}Show output
Traffic control for interface 'eth0' - 'egress' mode ------------------------------------------------------------------------------------ ID traffic control type parent bytes sent pkts sent pkts dropped ------------------------------------------------------------------------------------ 1:0 HTB htb root 6418599 4581 41 1:1 HTB class 1 1:0 0 0 0 1:2 HTB class 2 (default) 1:0 6418599 4581 0 2:0 - htb 1:1 0 0 0 3:0 - htb 1:2 6418599 4581 41