配置QinQ终结子接口复杂流分类示例
以QinQ终结子接口复杂流分类为例,介绍复杂流分类的配置。
组网需求
如图5-4所示,SwitchA、SwitchB通过DeviceA、DeviceB接入运营商网络。在DeviceA的QinQ终结子接口GE0/2/0.1上配置复杂流分类,限制SwitchA的用户的接入速率为10Mbit/s,承诺突发流量尺寸为150000字节。
QinQ接口的详细介绍和配置请参见《HUAWEI NE20E-S 综合业务承载路由器 配置指南-局域网接入与城域网接入》中的“QinQ配置”部分。
本例中interface1,interface2分别代表GE0/1/0,GE0/2/0.
数据准备
完成该举例,需要准备如下数据:
各接口的IP地址。
QinQ终结子接口终结的VLAN范围。
SwitchA的用户的接入速率10Mbit/s、承诺突发流量尺寸150000字节。
流分类、流行为、流量策略的名字以及应用的接口号。
操作步骤
- 配置骨干网的IGP,本示例中使用OSPF,配置请参见《HUAWEI NE20E-S 综合业务承载路由器 配置指南-IP路由》中的“OSPF配置”部分。
# 配置DeviceA。
<HUAWEI> system-view
[~HUAWEI] sysname DeviceA
[*HUAWEI] commit
[~DeviceA] interface gigabitethernet 0/1/0
[~DeviceA-GigabitEthernet0/1/0] undo shutdown
[*DeviceA-GigabitEthernet0/1/0] ip address 10.10.1.1 24
[*DeviceA-GigabitEthernet0/1/0] commit
[~DeviceA-GigabitEthernet0/1/0] quit
[~DeviceA] ospf
[*DeviceA-ospf-1] area 0
[*DeviceA-ospf-1-area-0.0.0.0] network 10.10.1.0 0.0.0.255
[*DeviceA-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255
[*DeviceA-ospf-1-area-0.0.0.0] commit
[~DeviceA-ospf-1-area-0.0.0.0] quit
[~DeviceA-ospf-1] quit
# 配置DeviceB。
<HUAWEI> system-view
[~HUAWEI] sysname DeviceB
[*HUAWEI] commit
[~DeviceB] interface gigabitethernet 0/1/0
[~DeviceB-GigabitEthernet0/1/0] undo shutdown
[*DeviceB-GigabitEthernet0/1/0] ip address 10.10.1.2 24
[*DeviceB-GigabitEthernet0/1/0] commit
[~DeviceB-GigabitEthernet0/1/0] quit
[~DeviceB] ospf
[*DeviceB-ospf-1] area 0
[*DeviceB-ospf-1-area-0.0.0.0] network 10.10.1.0 0.0.0.255
[*DeviceB-ospf-1-area-0.0.0.0] network 10.2.1.0 0.0.0.255
[*DeviceB-ospf-1-area-0.0.0.0] commit
[~DeviceB-ospf-1-area-0.0.0.0] quit
[~DeviceB-ospf-1] quit
- 配置QinQ终结子接口
# 配置DeviceA。
[~DeviceA] interface gigabitethernet 0/2/0.1
[*DeviceA-GigabitEthernet0/2/0.1] control-vid 1 qinq-termination
[*DeviceA-GigabitEthernet0/2/0.1] qinq termination pe-vid 100 ce-vid 10 to 20
[*DeviceA-GigabitEthernet0/2/0.1] ip address 10.1.1.1 24
[*DeviceA-GigabitEthernet0/2/0.1] commit
[~DeviceA-GigabitEthernet0/2/0.1] quit
# 配置DeviceB。
[~DeviceB] interface gigabitethernet 0/2/0.1
[*DeviceB-GigabitEthernet0/2/0.1] control-vid 1 qinq-termination
[*DeviceB-GigabitEthernet0/2/0.1] qinq termination pe-vid 100 ce-vid 10 to 20
[*DeviceB-GigabitEthernet0/2/0.1] ip address 10.2.1.1 24
[*DeviceB-GigabitEthernet0/2/0.1] commit
[~DeviceB-GigabitEthernet0/2/0.1] quit
- 在DeviceA上配置QinQ终结子接口的复杂流分类功能
# 配置流分类,定义匹配规则。
[~DeviceA] traffic classifier c1
[*DeviceA-classifier-c1] if-match any
[*DeviceA-classifier-c1] commit
[~DeviceA-classifier-c1] quit
# 定义流行为。
[~DeviceA] traffic behavior b1
[*DeviceA-behavior-b1] car cir 10000 cbs 150000 pbs 0
[*DeviceA-behavior-b1] commit
[~DeviceA-behavior-b1] quit
# 定义流量策略,将流分类与流行为关联。
[~DeviceA] traffic policy p1
[*DeviceA-trafficpolicy-p1] classifier c1 behavior b1
[*DeviceA-trafficpolicy-p1] commit
[~DeviceA-trafficpolicy-p1] quit
# 上述配置完成后,使用display traffic policy命令可以查看流量策略、策略中定义的流分类以及与流分类相关的流行为的配置情况。
[~Device] display traffic policy user-defined
User Defined Traffic Policy Information:
Policy: p1
Classifier: default-class
Behavior: be
-none-
Classifier: c1
Behavior: b1
Committed Access Rate:
CIR 10000 (Kbps), PIR 0 (Kbps), CBS 150000 (byte), PBS 0 (byte)
Conform Action: pass
Yellow Action: pass
Exceed Action: discard
# 将流量策略应用到接口上。
[~DeviceA] interface gigabitethernet 0/2/0.1
[*DeviceA-GigabitEthernet0/2/0.1] traffic-policy p1 inbound
[*DeviceA-GigabitEthernet0/2/0.1] commit
[~DeviceA-GigabitEthernet0/2/0.1] quit
- 检查配置结果
接口绑定流量策略后,DeviceA的GE0/2/0.1接口只接入10M的流量,超过的流量将被丢弃。
配置文件
DeviceA的配置文件
#
sysname DeviceA
#
traffic classifier c1 operator or
if-match any
#
traffic behavior b1
car cir 10000 cbs 150000 pbs 0 green pass yellow pass red discard
#
traffic policy p1
classifier c1 behavior b1
#
interface GigabitEthernet0/2/0.1
control-vid 1 qinq-termination
qinq termination pe-vid 100 ce-vid 10 to 20
ip address 10.1.1.1 255.255.255.0
traffic-policy p1 inbound
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 10.10.1.1 255.255.255.0
#
ospf 1
area 0.0.0.0
network 10.1.1.0 0.0.0.255
network 10.10.1.0 0.0.0.255
#
return
DeviceB的配置文件
#
sysname DeviceB
#
interface GigabitEthernet0/2/0.1
control-vid 1 qinq-termination
qinq termination pe-vid 100 ce-vid 10 to 20
ip address 10.2.1.1 255.255.255.0
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 10.10.1.2 255.255.255.0
#
ospf 1
area 0.0.0.0
network 10.2.1.0 0.0.0.255
network 10.10.1.0 0.0.0.255
#
return