NetEngine5000E 核心路由器 产品文档 : 描述>特性描述 > QoS > 流分类和标记 > 复杂流分类
以特性的典型配置场景为例,介绍通过BGP传播QoS策略的配置。
组网需求
如图1所示,DeviceB向DeviceA通告带有团体属性的BGP路由,DeviceA收到后,通过匹配BGP团体列表为BGP路由设置关联的流行为和QoS策略ID,对流经DeviceA的流量应用相应的QPPB本地策略。
DeviceB的网络到达DeviceC网络的流量需要经过DeviceA的网络,DeviceB是BGP路由的发送方,DeviceA是BGP路由的接收方。
要求在DeviceA的上行部署基于源的QPPB特性。
图1 QPPB配置组网图
本例中interface1,interface2分别代表GE1/0/0,GE2/0/0。
配置思路
采用如下的思路配置QPPB。
配置BGP的基本功能。
在DeviceB上配置路由策略,为发送的路由设置团体属性,并通过BGP发布路由策略。
在DeviceA上应用路由策略,匹配路由属性,设置关联的QoS策略ID(QoS Local-ID)。
在DeviceA的入接口上应用QPPB策略。
操作步骤
标题配置DeviceA和DeviceB的BGP基本功能
配置DeviceA和DeviceB的Loopback接口。
system-view
[~DeviceA] interface loopback 0
[*DeviceA-LoopBack0] ip address 1.1.1.1 255.255.255.255
[*DeviceA-LoopBack0] commit
[~DeviceA-LoopBack0] return
system-view
[~DeviceB] interface loopback 0
[*DeviceB-LoopBack0] ip address 2.2.2.2 255.255.255.255
配置DeviceA和DeviceB直连的接口,DeviceA和DeviceC直连的端口。
system-view
[~DeviceA] interface GigabitEthernet 2/0/0
[~DeviceA-GigabitEthernet2/0/0] undo shutdown
[*DeviceA-GigabitEthernet2/0/0] ip address 10.10.1.1 255.255.255.0
[*DeviceA-GigabitEthernet2/0/0] commit
[~DeviceA-GigabitEthernet2/0/0] quit
[~DeviceA] interface gigabitethernet 1/0/0
[~DeviceA-GigabitEthernet1/0/0] undo shutdown
[*DeviceA-GigabitEthernet1/0/0] ip address 10.20.1.2 255.255.255.0
[*DeviceA-GigabitEthernet1/0/0] commit
[~DeviceA-GigabitEthernet1/0/0] return
system-view
[~DeviceB] interface GigabitEthernet 1/0/0
[~DeviceB-GigabitEthernet1/0/0] undo shutdown
[*DeviceB-GigabitEthernet1/0/0] ip address 10.10.1.2 255.255.255.0
[*DeviceB-GigabitEthernet1/0/0] commit
[~DeviceB-GigabitEthernet1/0/0] return
system-view
[~DeviceC] interface gigabitethernet1/0/0
[~DeviceC-GigabitEthernet1/0/0] undo shutdown
[*DeviceC-GigabitEthernet1/0/0] ip address 10.20.1.1 255.255.255.0
[*DeviceC-GigabitEthernet1/0/0] commit
[~DeviceC-GigabitEthernet1/0/0] return
启动OSPF协议,发布接口地址的路由。
system-view
[~DeviceA] ospf
[*DeviceA-ospf-1] area 0
[*DeviceA-ospf-1-area-0.0.0.0] network 1.1.1.1 0.0.0.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.20.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] return
system-view
[~DeviceB] ospf
[*DeviceB-ospf] area 0
[*DeviceB-ospf-1-area-0.0.0.0] network 2.2.2.2 0.0.0.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] commit
[~DeviceB-ospf-1-area-0.0.0.0] quit
[~DeviceB-ospf-1] return
system-view
[~DeviceC] ospf
[*DeviceC-ospf] area 0
[*DeviceC-ospf-1-area-0.0.0.0] network 10.20.1.0 0.0.0.255
[*DeviceC-ospf-1-area-0.0.0.0] commit
[~DeviceC-ospf-1-area-0.0.0.0] return
配置BGP协议,DeviceA和DeviceB建立EBGP连接。
system-view
[~DeviceA] bgp 100
[*DeviceA-bgp] peer 2.2.2.2 as-number 200
[*DeviceA-bgp] peer 2.2.2.2 ebgp-max-hop 2
[*DeviceA-bgp] peer 2.2.2.2 connect-interface loopback 0
[*DeviceA-bgp] import-route direct
[*DeviceA-bgp] commit
[~DeviceA-bgp] return
system-view
[~DeviceB] bgp 200
[*DeviceB-bgp] peer 1.1.1.1 as-number 100
[*DeviceB-bgp] peer 1.1.1.1 ebgp-max-hop 2
[*DeviceB-bgp] peer 1.1.1.1 connect-interface loopback 0
[*DeviceB-bgp] import-route direct
[*DeviceB-bgp] commit
[~DeviceB-bgp] return
配置BGP协议,DeviceA和DeviceC建立IBGP连接。
system-view
[~DeviceA] bgp 100
[*DeviceA-bgp] peer 10.20.1.1 as-number 100
[*DeviceA-bgp] import-route direct
[*DeviceA-bgp] commit
[~DeviceA-bgp] quit
system-view
[~DeviceC] bgp 100
[*DeviceC-bgp] peer 10.20.1.2 as-number 100
[*DeviceC-bgp] import-route direct
[*DeviceC-bgp] commit
[~DeviceC-bgp] quit
配置完成后可以看到DeviceA和DeviceB,DeviceC之间可以实现互通。
配置路由发送端DeviceB的路由策略,并应用路由策略
配置路由发送端的ip-prefix。
system-view
[~DeviceB] ip ip-prefix bb permit 66.1.1.1 32
[*DeviceB] commit
[~DeviceB] return
配置路由发送端的路由策略。
system-view
[~DeviceB] route-policy aa permit node 10
[*DeviceB-route-policy] if-match ip-prefix bb
[*DeviceB-route-policy] apply community 10:10
[*DeviceB-route-policy] commit
[~DeviceB-route-policy] return
在路由发送端通过BGP发布路由策略。
system-view
[~DeviceB] bgp 200
[*DeviceB-bgp] peer 1.1.1.1 route-policy aa export
[*DeviceB-bgp] peer 1.1.1.1 advertise-community
[*DeviceB-bgp] commit
[~DeviceB-bgp] return
配置路由接收端DeviceA的路由接收策略,对匹配路由属性的流量应用关联的流行为
配置QoS策略,即关联的流行为。
system-view
[~DeviceA] traffic behavior dd
[*DeviceA-behavior-dd] remark dscp af11
[*DeviceA-behavior-dd] commit
[~DeviceA-behavior-dd] return
配置路由接收策略,使匹配团体属性的路由应用关联的流行为。
system-view
[~DeviceA] ip community-filter 10 permit 10:10
[*DeviceA] route-policy aa permit node 10
[*DeviceA-route-policy] if-match community-filter 10
[*DeviceA-route-policy] apply qos-local-id 1
[*DeviceA-route-policy] commit
[~DeviceA-route-policy] return
在DeviceA上配置QPPB策略。
system-view
[~DeviceA] qppb local-policy ac
[*DeviceA-localpolicy-ac] qos-local-id 1 behavior dd
[*DeviceA-localpolicy-ac] commit
[~DeviceA-localpolicy-ac] return
在DeviceA上对从对等体DeviceB发布过来的路由应用接收端路由策略。
system-view
[~DeviceA] bgp 100
[*DeviceA-bgp] peer 2.2.2.2 route-policy aa import
[*DeviceA-bgp] commit
[~DeviceA-bgp] return
在接收端DeviceA上,流量的入接口上应用QPPB
system-view
[~DeviceA] interface GigabitEthernet 2/0/0
[~DeviceA-GigabitEthernet2/0/0] qppb-policy ac source inbound
[*DeviceA-GigabitEthernet2/0/0] commit
[~DeviceA-GigabitEthernet2/0/0] return
检查配置结果
在DeviceA上显示QPPB本地策略的信息如下。
[~DeviceA] display qppb local-policy configuration ac
qppb local-policy: ac
statistics disable
is-used yes
qos-local-id 1 behavior dd
配置文件
DeviceA的配置文件
sysname DeviceA
interface GigabitEthernet1/0/0
undo shutdown
ip address 10.20.1.2 255.255.255.0
interface GigabitEthernet2/0/0
undo shutdown
ip address 10.10.1.1 255.255.255.0
qppb-policy ac source inbound
interface LoopBack0
ip address 1.1.1.1 255.255.255.255
bgp 100
peer 2.2.2.2 as-number 200
peer 2.2.2.2 ebgp-max-hop 2
peer 2.2.2.2 connect-interface LoopBack0
peer 10.20.1.1 as-number 100
ipv4-family unicast
undo synchronization
import-route direct
peer 2.2.2.2 enable
peer 2.2.2.2 route-policy aa import
peer 10.20.1.1 enable
ospf 1
area 0.0.0.0
network 1.1.1.1 0.0.0.0
network 10.10.1.0 0.0.0.255
network 10.20.1.0 0.0.0.255
traffic behavior dd
remark dscp af11
route-policy aa permit node 10
if-match community-filter 10
apply qos-local-id 1
ip community-filter 10 permit 10:10
qppb local-policy ac
qos-local-id 1 behavior dd
return
DeviceB的配置文件
sysname DeviceB
interface GigabitEthernet2/0/0
undo shutdown
ip address 10.10.1.2 255.255.255.0
interface LoopBack0
ip address 2.2.2.2 255.255.255.255
interface LoopBack10
ip address 66.1.1.1 255.255.255.255
bgp 200
peer 1.1.1.1 as-number 100
peer 1.1.1.1 ebgp-max-hop 2
peer 1.1.1.1 connect-interface LoopBack0
ipv4-family unicast
undo synchronization
import-route direct
peer 1.1.1.1 enable
peer 1.1.1.1 route-policy aa export
peer 1.1.1.1 advertise-community
quit
ospf 1
area 0.0.0.0
network 2.2.2.2 0.0.0.0
network 10.10.1.0 0.0.0.255
route-policy aa permit node 10
if-match ip-prefix bb
apply community 10:10
ip ip-prefix bb index 10 permit 66.1.1.1 32
return
DeviceC的配置文件
sysname DeviceC
interface GigabitEthernet1/0/0
undo shutdown
ip address 10.20.1.1 255.255.255.0
bgp 100
peer 10.20.1.2 as-number 100
ipv4-family unicast
undo synchronization
import-route direct
peer 10.20.1.2 enable
ospf 1
area 0.0.0.0
network 10.20.1.0 0.0.0.255
return