Example for Configuring Priority Re-marking
Networking Requirements
As shown in Figure 8-2, voice, video, and data terminals on the enterprise's LAN connect to Eth2/0/0 and Eth2/0/1 of RouterA through SwitchA and SwitchB. These terminals connect to the WAN through GE3/0/0 of RouterA.
Packets of different services are identified by 802.1p priorities on the LAN. When packets reach the WAN through GE3/0/0, it is required that differentiated services are provided based on DSCP priorities.
Configuration Roadmap
- Create VLANs and VLANIF interfaces on RouterA and configure interfaces so that enterprise users can access the WAN-side network through RouterA.
- Configure traffic classifiers on RouterA to classify packets based on 802.1p priorities.
- Configure traffic behaviors on RouterA to re-mark 802.1p priorities of packets with DSCP priorities.
- Configure a traffic policy on RouterA, bind the configured traffic behaviors and traffic classifiers to the traffic policy, and apply the traffic policy to Eth2/0/0 and Eth2/0/1 in the inbound direction so that packets are re-marked.
Procedure
- Create VLANs and configure interfaces.
# Create VLAN 20 and VLAN 30 on RouterA.
<Huawei> system-view [Huawei] sysname RouterA [RouterA] vlan batch 20 30
# Configure Eth2/0/0 and Eth2/0/1 as trunk interfaces, and add Eth2/0/0 to VLAN 20 and Eth2/0/1 to VLAN 30.
[RouterA] interface ethernet 2/0/0 [RouterA-Ethernet2/0/0] port link-type trunk [RouterA-Ethernet2/0/0] port trunk allow-pass vlan 20 [RouterA-Ethernet2/0/0] quit [RouterA] interface ethernet 2/0/1 [RouterA-Ethernet2/0/1] port link-type trunk [RouterA-Ethernet2/0/1] port trunk allow-pass vlan 30 [RouterA-Ethernet2/0/1] quit
Configure the interface of SwitchA connected to RouterA as a trunk interface and add it to VLAN 20.
Configure the interface of SwitchB connected to RouterA as a trunk interface and add it to VLAN 30.
# Create VLANIF 20 and VLANIF 30, and assign IP address 192.168.2.1/24 to VLANIF 20 and IP address 192.168.3.1/24 to VLANIF 30.
[RouterA] interface vlanif 20 [RouterA-Vlanif20] ip address 192.168.2.1 24 [RouterA-Vlanif20] quit [RouterA] interface vlanif 30 [RouterA-Vlanif30] ip address 192.168.3.1 24 [RouterA-Vlanif30] quit
# Configure IP address 192.168.4.1/24 for GE3/0/0 on RouterA.
[RouterA] interface gigabitethernet 3/0/0 [RouterA-GigabitEthernet3/0/0] ip address 192.168.4.1 24 [RouterA-GigabitEthernet3/0/0] quit
# Configure IP address 192.168.4.2/24 for GE3/0/0 on RouterB.
<Huawei> system-view [Huawei] sysname RouterB [RouterB] interface gigabitethernet 3/0/0 [RouterB-GigabitEthernet3/0/0] ip address 192.168.4.2 24 [RouterB-GigabitEthernet3/0/0] quit
# Configure RouterB to interwork with the LAN-side device.
[RouterB] ip route-static 192.168.2.0 255.255.255.0 192.168.4.1 [RouterB] ip route-static 192.168.3.0 255.255.255.0 192.168.4.1
Configure the default gateway address 192.168.2.1/24 for enterprise users connected to SwitchA.
Configure the default gateway address 192.168.3.1/24 for enterprise users connected to SwitchB.
- Configure traffic classifiers.
# Create and configure traffic classifiers c1, c2, and c3 on RouterA to classify packets based on 802.1p priorities.
[RouterA] traffic classifier c1 [RouterA-classifier-c1] if-match 8021p 2 [RouterA-classifier-c1] quit [RouterA] traffic classifier c2 [RouterA-classifier-c2] if-match 8021p 5 [RouterA-classifier-c2] quit [RouterA] traffic classifier c3 [RouterA-classifier-c3] if-match 8021p 6 [RouterA-classifier-c3] quit
- Configure traffic behaviors.
# Create and configure traffic behaviors b1, b2, and b3 on RouterA to re-mark 802.1p priorities of packets with DSCP priorities.
[RouterA] traffic behavior b1 [RouterA-behavior-b1] remark dscp 15 [RouterA-behavior-b1] quit [RouterA] traffic behavior b2 [RouterA-behavior-b2] remark dscp 40 [RouterA-behavior-b2] quit [RouterA] traffic behavior b3 [RouterA-behavior-b3] remark dscp 50 [RouterA-behavior-b3] quit
- Configure traffic policies and apply the traffic policies
to interfaces.
# Create a traffic policy p1 on RouterA, bind the traffic behaviors and traffic classifiers to the traffic policy, and apply the traffic policy to Eth2/0/0 and Eth2/0/1 in the inbound direction.
[RouterA] traffic policy p1 [RouterA-trafficpolicy-p1] classifier c1 behavior b1 [RouterA-trafficpolicy-p1] classifier c2 behavior b2 [RouterA-trafficpolicy-p1] classifier c3 behavior b3 [RouterA-trafficpolicy-p1] quit [RouterA] interface ethernet 2/0/0 [RouterA-Ethernet2/0/0] traffic-policy p1 inbound [RouterA-Ethernet2/0/0] quit [RouterA] interface ethernet 2/0/1 [RouterA-Ethernet2/0/1] traffic-policy p1 inbound [RouterA-Ethernet2/0/1] quit
- Verify the configuration.
# View the traffic classifier configuration.
<RouterA> display traffic classifier user-defined User Defined Classifier Information: Classifier: c2 Operator: OR Rule(s) : if-match 8021p 5 Classifier: c3 Operator: OR Rule(s) : if-match 8021p 6 Classifier: c1 Operator: OR Rule(s) : if-match 8021p 2
# View the traffic policy configuration.
<RouterA> display traffic policy user-defined p1 User Defined Traffic Policy Information: Policy: p1 Classifier: c1 Operator: OR Behavior: b1 Marking: Remark DSCP 15 Classifier: c2 Operator: OR Behavior: b2 Marking: Remark DSCP cs5 Classifier: c3 Operator: OR Behavior: b3 Marking: Remark DSCP 50
Configuration Files
- RouterA configuration
file
# sysname RouterA # vlan batch 20 30 # traffic classifier c3 operator or if-match 8021p 6 traffic classifier c2 operator or if-match 8021p 5 traffic classifier c1 operator or if-match 8021p 2 # traffic behavior b3 remark dscp 50 traffic behavior b2 remark dscp cs5 traffic behavior b1 remark dscp 15 # traffic policy p1 classifier c1 behavior b1 classifier c2 behavior b2 classifier c3 behavior b3 # interface Vlanif20 ip address 192.168.2.1 255.255.255.0 # interface Vlanif30 ip address 192.168.3.1 255.255.255.0 # interface Ethernet2/0/0 port link-type trunk port trunk allow-pass vlan 20 traffic-policy p1 inbound # interface Ethernet2/0/1 port link-type trunk port trunk allow-pass vlan 30 traffic-policy p1 inbound # interface GigabitEthernet3/0/0 ip address 192.168.4.1 255.255.255.0 # return
- RouterB configuration
file
# sysname RouterB # interface GigabitEthernet3/0/0 ip address 192.168.4.2 255.255.255.0 # ip route-static 192.168.2.0 255.255.255.0 192.168.4.1 ip route-static 192.168.3.0 255.255.255.0 192.168.4.1 # return