Example for Configuring Re-marking
Networking Requirements
As shown in Figure 9-2, tenant 1 and tenant 2 connect to the Switch (core switch) through SwitchA and SwitchB respectively, and connect to the Internet through egress routers.
Packets sent by tenant servers to the Switch are identified by VLAN IDs, and packets from servers of tenant 1 and tenant 2 carry VLAN 10 and VLAN 20 respectively. It is required that the CoS of tenant 1 be higher than that of tenant 2 to ensure service experience of tenant 1.
Configuration Roadmap
- Create VLANs on the Switch and configure interfaces so that the Switch can connect to SwitchA and SwitchB.
- Configure traffic classifiers on the Switch to classify packets based on VLAN IDs.
- Configure traffic behaviors on the Switch to re-mark priorities in packets from tenant 1 with 4 and priorities in packets from tenant 2 with 2 so that packets from tenant 1 have higher priority than packets from tenant 2.
- Configure a traffic policy on the Switch, bind the configured traffic behaviors and traffic classifiers to the traffic policy, and apply the traffic policy to 10GE1/0/1 and 10GE1/0/2 in the inbound direction so that packets sent from tenants are re-marked.
Procedure
- Create VLANs and configure interfaces.
# Create VLAN 10 and VLAN 20 on the Switch.
<HUAWEI> system-view [~HUAWEI] sysname Switch [*HUAWEI] commit [~Switch] vlan batch 10 20 [*Switch] commit
# Configure 10GE1/0/1 and 10GE1/0/2 on the Switch as trunk interfaces and 10GE1/0/3 and 10GE1/0/4 as trunk interfaces, and add 10GE1/0/1 to VLAN 10, 10GE1/0/2 to VLAN 20, and 10GE1/0/3 and 10GE1/0/4 to VLAN 10 and VLAN 20.
[~Switch] interface 10ge 1/0/1 [*Switch-10GE1/0/1] port link-type trunk [*Switch-10GE1/0/1] port trunk allow-pass vlan 10 [*Switch-10GE1/0/1] quit [*Switch] interface 10ge 1/0/2 [*Switch-10GE1/0/2] port link-type trunk [*Switch-10GE1/0/2] port trunk allow-pass vlan 20 [*Switch-10GE1/0/2] quit [*Switch] interface 10ge 1/0/3 [*Switch-10GE1/0/3] port link-type trunk [*Switch-10GE1/0/3] port trunk allow-pass vlan 10 20 [*Switch-10GE1/0/3] quit [*Switch] interface 10ge 1/0/4 [*Switch-10GE1/0/4] port link-type trunk [*Switch-10GE1/0/4] port trunk allow-pass vlan 10 20 [*Switch-10GE1/0/4] quit [*Switch] commit
# Create VLAN 10 on SwitchA, configure 10GE1/0/1 as a trunk interface, and add 10GE1/0/2 and 10GE1/0/1 to VLAN 10.
<HUAWEI> system-view [~HUAWEI] sysname SwitchA [*HUAWEI] commit [~SwitchA] vlan batch 10 [*SwitchA] commit [~SwitchA] interface 10ge 1/0/2 [*SwitchA-10GE1/0/2] port default vlan 10 [*SwitchA-10GE1/0/2] quit [*SwitchA] interface 10ge 1/0/1 [*SwitchA-10GE1/0/1] port link-type trunk [*SwitchA-10GE1/0/1] port trunk allow-pass vlan 10 [*SwitchA-10GE1/0/1] quit [*SwitchA] commit
# Create VLAN 20 on SwitchB, configure 10GE1/0/1 as a trunk interface, and add 10GE1/0/2 and 10GE1/0/1 to VLAN 20.
<HUAWEI> system-view [~HUAWEI] sysname SwitchB [*HUAWEI] commit [~SwitchB] vlan batch 20 [*SwitchB] commit [~SwitchB] interface 10ge 1/0/2 [*SwitchB-10GE1/0/2] port default vlan 20 [*SwitchB-10GE1/0/2] quit [*SwitchB] interface 10ge 1/0/1 [*SwitchB-10GE1/0/1] port link-type trunk [*SwitchB-10GE1/0/1] port trunk allow-pass vlan 20 [*SwitchB-10GE1/0/1] quit [*SwitchB] commit
- Configure traffic classifiers.
# Create and configure traffic classifiers c1 and c2 on the Switch to classify packets based on VLAN IDs.
[~Switch] traffic classifier c1 [*Switch-classifier-c1] if-match vlan 10 [*Switch-classifier-c1] quit [*Switch] traffic classifier c2 [*Switch-classifier-c2] if-match vlan 20 [*Switch-classifier-c2] quit [*Switch] commit
- Configure traffic behaviors.
# Configure traffic behaviors b1 and b2 on the Switch to re-mark priorities of user packets.
[~Switch] qos phb marking 8021p disable [*Switch] commit [~Switch] traffic behavior b1 [*Switch-behavior-b1] remark 8021p 4 [*Switch-behavior-b1] quit [*Switch] traffic behavior b2 [*Switch-behavior-b2] remark 8021p 2 [*Switch-behavior-b2] quit [*Switch] commit
- Configure traffic policies and apply the traffic policies to interfaces.
# Create traffic policies p1 and p2 on the Switch, bind the traffic behaviors and traffic classifiers to the traffic policies, and apply the traffic policies p1 and p2 to the inbound direction of 10GE1/0/1 and 10GE1/0/2 to re-mark packets.
[~Switch] traffic policy p1 [*Switch-trafficpolicy-p1] classifier c1 behavior b1 [*Switch-trafficpolicy-p1] quit [*Switch] traffic policy p2 [*Switch-trafficpolicy-p2] classifier c2 behavior b2 [*Switch-trafficpolicy-p2] quit [*Switch] interface 10ge 1/0/1 [*Switch-10GE1/0/1] traffic-policy p1 inbound [*Switch-10GE1/0/1] quit [*Switch] interface 10ge 1/0/2 [*Switch-10GE1/0/2] traffic-policy p2 inbound [*Switch-10GE1/0/2] quit [*Switch] commit [~Switch] quit
- Verify the configuration.
# View the traffic classifier configuration.
<Switch> display traffic classifier Traffic Classifier Information: Classifier: c1 Type: OR Rule(s): if-match vlan 10 Classifier: c2 Type: OR Rule(s): if-match vlan 20 Total classifier number is 2
# View the traffic policy configuration.
<Switch> display traffic policy Traffic Policy Information: Policy: p1 Classifier: c1 Type: OR Behavior: b1 Remark: Remark 8021p 4 Policy: p2 Classifier: c2 Type: OR Behavior: b2 Remark: Remark 8021p 2 Total policy number is 2
# View the traffic policy record.
<Switch> display traffic-policy applied-record Total records : 2 -------------------------------------------------------------------------------- Policy Type/Name Apply Parameter Slot State -------------------------------------------------------------------------------- p1 10GE1/0/1(IN) 1 success p2 10GE1/0/2(IN) 1 success --------------------------------------------------------------------------------
Configuration Files
Switch configuration file
# sysname Switch # qos phb marking 8021p disable # vlan batch 10 20 # traffic classifier c1 type or if-match vlan 10 # traffic classifier c2 type or if-match vlan 20 # traffic behavior b1 remark 8021p 4 # traffic behavior b2 remark 8021p 2 # traffic policy p1 classifier c1 behavior b1 precedence 5 # traffic policy p2 classifier c2 behavior b2 precedence 5 # interface 10GE1/0/1 port link-type trunk port trunk allow-pass vlan 10 traffic-policy p1 inbound # interface 10GE1/0/2 port link-type trunk port trunk allow-pass vlan 20 traffic-policy p2 inbound # interface 10GE1/0/3 port link-type trunk port trunk allow-pass vlan 10 20 # interface 10GE1/0/4 port link-type trunk port trunk allow-pass vlan 10 20 # return
SwitchA configuration file
# sysname SwitchA # vlan batch 10 # interface 10GE1/0/1 port link-type trunk port trunk allow-pass vlan 10 # interface 10GE1/0/2 port default vlan 10 # return
SwitchB configuration file
# sysname SwitchB # vlan batch 20 # interface 10GE1/0/1 port link-type trunk port trunk allow-pass vlan 20 # interface 10GE1/0/2 port default vlan 20 # return