Vlan Preclassification

The following scenario shows how to pre-classify packets using traffic policies. This reduces packet processing time and improves system performance.

../../../../_images/vlanpreclassification.svg

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 1
Show 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.655 ms

--- 10.0.0.2 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.655/0.655/0.655/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 1
Expect the following output on DUT0:
Connecting to host 10.0.0.2, port 5001
[  5] local 10.0.0.1 port 40360 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  160   81.0 KBytes
[  5]   1.00-2.00   sec  11.3 MBytes  95.1 Mbits/sec   78   78.4 KBytes
[  5]   2.00-3.00   sec  11.4 MBytes  95.6 Mbits/sec   77   81.0 KBytes
[  5]   3.00-4.00   sec  11.3 MBytes  94.5 Mbits/sec   78   73.2 KBytes
[  5]   4.00-5.00   sec  11.5 MBytes  96.6 Mbits/sec   77   70.6 KBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-5.00   sec  58.9 MBytes  98.8 Mbits/sec  470             sender
[  5]   0.00-5.00   sec  58.2 MBytes  97.7 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}\s
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      64160293      45722            17
1:1  HTB              class 1            1:0       64159813      45718             0
1:2  HTB              class 2 (default)  1:0            480          4             0
2:0  -                htb                1:1       64159813      45718            17
3:0  -                htb                1:2            480          4             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 1
Expect the following output on DUT0:
Connecting to host 10.0.0.2, port 5001
[  5] local 10.0.0.1 port 44754 connected to 10.0.0.2 port 5001
[ ID] Interval           Transfer     Bitrate         Retr  Cwnd
[  5]   0.00-1.00   sec  1.61 MBytes  13.5 Mbits/sec   84   11.8 KBytes
[  5]   1.00-2.00   sec  1.10 MBytes  9.25 Mbits/sec   30   7.84 KBytes
[  5]   2.00-3.00   sec  1.10 MBytes  9.25 Mbits/sec   24   10.5 KBytes
[  5]   3.00-4.00   sec  1.10 MBytes  9.25 Mbits/sec   45   10.5 KBytes
[  5]   4.00-5.00   sec  1.22 MBytes  10.3 Mbits/sec   42   13.1 KBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-5.00   sec  6.14 MBytes  10.3 Mbits/sec  225             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       6425504       4600            42
1:1  HTB              class 1            1:0              0          0             0
1:2  HTB              class 2 (default)  1:0        6425504       4600             0
2:0  -                htb                1:1              0          0             0
3:0  -                htb                1:2        6425504       4600            42

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 1
Show 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.466 ms

--- 10.0.0.2 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.466/0.466/0.466/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 1
Expect the following output on DUT0:
Connecting to host 10.0.0.2, port 5001
[  5] local 10.0.0.1 port 48216 connected to 10.0.0.2 port 5001
[ ID] Interval           Transfer     Bitrate         Retr  Cwnd
[  5]   0.00-1.00   sec  13.5 MBytes   113 Mbits/sec  174   77.1 KBytes
[  5]   1.00-2.00   sec  11.4 MBytes  95.6 Mbits/sec   69   71.9 KBytes
[  5]   2.00-3.00   sec  11.1 MBytes  92.9 Mbits/sec   35    105 KBytes
[  5]   3.00-4.00   sec  11.4 MBytes  95.6 Mbits/sec   85   79.7 KBytes
[  5]   4.00-5.00   sec  11.3 MBytes  95.0 Mbits/sec   35   73.2 KBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-5.00   sec  58.7 MBytes  98.4 Mbits/sec  398             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}\s
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      64159109      45589            14
1:1  HTB              class 1            1:0       64158889      45587             0
1:2  HTB              class 2 (default)  1:0            220          2             0
2:0  -                htb                1:1       64158889      45587            14
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
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 1
Expect the following output on DUT0:
Connecting to host 10.0.0.2, port 5001
[  5] local 10.0.0.1 port 46310 connected to 10.0.0.2 port 5001
[ ID] Interval           Transfer     Bitrate         Retr  Cwnd
[  5]   0.00-1.00   sec  1.69 MBytes  14.1 Mbits/sec  113   13.1 KBytes
[  5]   1.00-2.00   sec  1.10 MBytes  9.25 Mbits/sec   49   13.1 KBytes
[  5]   2.00-3.00   sec  1.10 MBytes  9.25 Mbits/sec   47   13.1 KBytes
[  5]   3.00-4.00   sec  1.10 MBytes  9.25 Mbits/sec   47   9.15 KBytes
[  5]   4.00-5.00   sec  1.29 MBytes  10.8 Mbits/sec   25   10.5 KBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-5.00   sec  6.28 MBytes  10.5 Mbits/sec  281             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       6421534       4585            46
1:1  HTB              class 1            1:0              0          0             0
1:2  HTB              class 2 (default)  1:0        6421534       4585             0
2:0  -                htb                1:1              0          0             0
3:0  -                htb                1:2        6421534       4585            46

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 1
Show 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.600 ms

--- 10.0.0.2 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.600/0.600/0.600/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 1
Expect the following output on DUT0:
Connecting to host 10.0.0.2, port 5001
[  5] local 10.0.0.1 port 44890 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  158   77.1 KBytes
[  5]   1.00-2.00   sec  11.4 MBytes  95.6 Mbits/sec   72   79.7 KBytes
[  5]   2.00-3.00   sec  11.4 MBytes  95.6 Mbits/sec   90   73.2 KBytes
[  5]   3.00-4.00   sec  11.3 MBytes  95.0 Mbits/sec   93   64.0 KBytes
[  5]   4.00-5.00   sec  11.3 MBytes  95.1 Mbits/sec   44   94.1 KBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-5.00   sec  58.9 MBytes  98.8 Mbits/sec  457             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}\s
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      64149905      45586            18
1:1  HTB              class 1            1:0       64148985      45578             0
1:2  HTB              class 2 (default)  1:0            920          8             0
2:0  -                htb                1:1       64148985      45578            18
3:0  -                htb                1:2            920          8             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 1
Expect the following output on DUT0:
Connecting to host 10.0.0.2, port 5001
[  5] local 10.0.0.1 port 53384 connected to 10.0.0.2 port 5001
[ ID] Interval           Transfer     Bitrate         Retr  Cwnd
[  5]   0.00-1.00   sec  1.55 MBytes  13.0 Mbits/sec   70   9.15 KBytes
[  5]   1.00-2.00   sec  1.10 MBytes  9.25 Mbits/sec   31   9.15 KBytes
[  5]   2.00-3.00   sec  1.10 MBytes  9.25 Mbits/sec   28   11.8 KBytes
[  5]   3.00-4.00   sec  1.10 MBytes  9.25 Mbits/sec   31   14.4 KBytes
[  5]   4.00-5.00   sec  1.22 MBytes  10.3 Mbits/sec   28   11.8 KBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-5.00   sec  6.08 MBytes  10.2 Mbits/sec  188             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       6423224       4584            42
1:1  HTB              class 1            1:0              0          0             0
1:2  HTB              class 2 (default)  1:0        6423224       4584             0
2:0  -                htb                1:1              0          0             0
3:0  -                htb                1:2        6423224       4584            42