Example for Configuring Flow-based Selective QinQ
Networking Requirements
In Figure 10-13, Internet access users (using PCs) and VoIP users (using VoIP terminals) connect to the ISP network through SwitchA and SwitchB. These users communicate with each other through the ISP network.
Packets from PCs and VoIP terminals need to be transmitted over the ISP network in VLAN 2 and VLAN 3 respectively.
You can configure a traffic policy to implement selective QinQ on the Switch.
Configuration Roadmap
The configuration roadmap is as follows:
Create VLANs on SwitchA and SwitchB.
Configure traffic classifiers, traffic behaviors, and bind them in a traffic policy on SwitchA and SwitchB.
Configure link types of interfaces on SwitchA and SwitchB, and add the interfaces to VLANs.
Apply the traffic policy to interfaces of SwitchA and SwitchB to implement selective QinQ.
Procedure
- Create VLANs.
# On SwitchA, create VLAN 2 and VLAN 3, that is, VLAN IDs in the outer VLAN tags to be added.
<HUAWEI> system-view [HUAWEI] sysname SwitchA [SwitchA] vlan batch 2 3
# On SwitchB, create VLAN 2 and VLAN 3, that is, VLAN IDs in the outer VLAN tags to be added.
<HUAWEI> system-view [HUAWEI] sysname SwitchB [SwitchB] vlan batch 2 3
- Configure a traffic policy on SwitchA.
Configure traffic classifiers, traffic behaviors, and a traffic policy on SwitchA.
[SwitchA] traffic classifier name1 [SwitchA-classifier-name1] if-match vlan-id 100 to 200 [SwitchA-classifier-name1] quit [SwitchA] traffic behavior name1 [SwitchA-behavior-name1] add-tag vlan-id 2 [SwitchA-behavior-name1] quit [SwitchA] traffic classifier name2 [SwitchA-classifier-name2] if-match vlan-id 300 to 400 [SwitchA-classifier-name2] quit [SwitchA] traffic behavior name2 [SwitchA-behavior-name2] add-tag vlan-id 3 [SwitchA-behavior-name2] quit [SwitchA] traffic policy name1 [SwitchA-trafficpolicy-name1] classifier name1 behavior name1 [SwitchA-trafficpolicy-name1] classifier name2 behavior name2 [SwitchA-trafficpolicy-name1] quit
# Configure traffic classifiers, traffic behaviors, and a traffic policy on SwitchB.
[SwitchB] traffic classifier name1 [SwitchB-classifier-name1] if-match vlan-id 100 to 200 [SwitchB-classifier-name1] quit [SwitchB] traffic behavior name1 [SwitchB-behavior-name1] add-tag vlan-id 2 [SwitchB-behavior-name1] quit [SwitchB] traffic classifier name2 [SwitchB-classifier-name2] if-match vlan-id 300 to 400 [SwitchB-classifier-name2] quit [SwitchB] traffic behavior name2 [SwitchB-behavior-name2] add-tag vlan-id 3 [SwitchB-behavior-name2] quit [SwitchB] traffic policy name1 [SwitchB-trafficpolicy-name1] classifier name1 behavior name1 [SwitchB-trafficpolicy-name1] classifier name2 behavior name2 [SwitchB-trafficpolicy-name1] quit
- Apply the traffic policy to interfaces of SwitchA and SwitchB to implement selective
QinQ.
# Configure GE 1/0/1 on SwitchA.
[SwitchA] interface gigabitethernet 1/0/1 [SwitchA-GigabitEthernet1/0/1] port link-type hybrid [SwitchA-GigabitEthernet1/0/1] port hybrid untagged vlan 2 3 [SwitchA-GigabitEthernet1/0/1] traffic-policy name1 inbound [SwitchA-GigabitEthernet1/0/1] quit
# Configure GE 1/0/1 on SwitchB.
[SwitchB] interface gigabitethernet 1/0/1 [SwitchB-GigabitEthernet1/0/1] port link-type hybrid [SwitchB-GigabitEthernet1/0/1] port hybrid untagged vlan 2 3 [SwitchB-GigabitEthernet1/0/1] traffic-policy name1 inbound [SwitchB-GigabitEthernet1/0/1] quit
- Configure other interfaces.
# Add GE 1/0/2 on SwitchA to VLAN 2 and VLAN 3.
[SwitchA] interface gigabitethernet 1/0/2 [SwitchA-GigabitEthernet1/0/2] port link-type trunk [SwitchA-GigabitEthernet1/0/2] port trunk allow-pass vlan 2 3 [SwitchA-GigabitEthernet1/0/2] quit
# Add GE 1/0/2 on SwitchB to VLAN 2 and VLAN 3.
[SwitchB] interface gigabitethernet 1/0/2 [SwitchB-GigabitEthernet1/0/2] port link-type trunk [SwitchB-GigabitEthernet1/0/2] port trunk allow-pass vlan 2 3 [SwitchB-GigabitEthernet1/0/2] quit
- Verify the configuration.
If the configurations on SwitchA and SwitchB are correct, the following situations occur:
PCs can communicate with each other through the ISP network.
VoIP terminals can communicate with each other through the ISP network.
Configuration Files
SwitchA configuration file
# sysname SwitchA # vlan batch 2 to 3 # traffic classifier name1 operator or precedence 5 if-match vlan-id 100 to 200 traffic classifier name2 operator or precedence 10 if-match vlan-id 300 to 400 # traffic behavior name1 permit add-tag vlan-id 2 traffic behavior name2 permit add-tag vlan-id 3 # traffic policy name1 match-order config classifier name1 behavior name1 classifier name2 behavior name2 # interface GigabitEthernet1/0/1 port link-type hybrid port hybrid untagged vlan 2 to 3 traffic-policy name1 inbound # interface GigabitEthernet1/0/2 port link-type trunk port trunk allow-pass vlan 2 to 3 # return
SwitchB configuration file
# sysname SwitchB # vlan batch 2 to 3 # traffic classifier name1 operator or precedence 5 if-match vlan-id 100 to 200 traffic classifier name2 operator or precedence 10 if-match vlan-id 300 to 400 # traffic behavior name1 permit add-tag vlan-id 2 traffic behavior name2 permit add-tag vlan-id 3 # traffic policy name1 match-order config classifier name1 behavior name1 classifier name2 behavior name2 # interface GigabitEthernet1/0/1 port link-type hybrid port hybrid untagged vlan 2 to 3 traffic-policy name1 inbound # interface GigabitEthernet1/0/2 port link-type trunk port trunk allow-pass vlan 2 to 3 # return