配置QPPB示例(BGP)
以特性的典型配置场景为例,介绍通过BGP传播QoS策略的配置。
组网需求
如图7-4所示,DeviceB向DeviceA通告带有团体属性的BGP路由,DeviceA收到后,通过匹配BGP团体列表为BGP路由设置关联的流行为和QoS策略ID,对流经DeviceA的流量应用相应的QPPB本地策略。
DeviceB的网络到达DeviceC网络的流量需要经过DeviceA的网络,DeviceB是BGP路由的发送方,DeviceA是BGP路由的接收方。
要求在DeviceA的上行部署基于源的QPPB特性。
本例中interface1,interface2分别代表GE0/1/0,GE0/2/0。
配置思路
采用如下的思路配置QPPB。
配置BGP的基本功能。
在DeviceB上配置路由策略,为发送的路由设置团体属性,并通过BGP发布路由策略。
在DeviceA上应用路由策略,匹配路由属性,设置关联的QoS策略ID(QoS Local-ID)。
在DeviceA的入接口上应用QPPB策略。
操作步骤
- 配置DeviceA和DeviceB的BGP基本功能
# 配置DeviceA和DeviceB的Loopback接口。
<DeviceA> system-view
[~DeviceA] interface loopback 0
[*DeviceA-LoopBack0] ip address 1.1.1.1 255.255.255.255
[*DeviceA-LoopBack0] commit
[~DeviceA-LoopBack0] return
<DeviceB> system-view
[~DeviceB] interface loopback 0
[*DeviceB-LoopBack0] ip address 2.2.2.2 255.255.255.255
# 配置DeviceA和DeviceB直连的接口,DeviceA和DeviceC直连的端口。
<DeviceA> system-view
[~DeviceA] interface GigabitEthernet 0/2/0
[~DeviceA-GigabitEthernet0/2/0] undo shutdown
[*DeviceA-GigabitEthernet0/2/0] ip address 10.10.1.1 255.255.255.0
[*DeviceA-GigabitEthernet0/2/0] commit
[~DeviceA-GigabitEthernet0/2/0] quit
[~DeviceA] interface gigabitethernet 0/1/0
[~DeviceA-GigabitEthernet0/1/0] undo shutdown
[*DeviceA-GigabitEthernet0/1/0] ip address 10.20.1.2 255.255.255.0
[*DeviceA-GigabitEthernet0/1/0] commit
[~DeviceA-GigabitEthernet0/1/0] return
<DeviceB> system-view
[~DeviceB] interface GigabitEthernet 0/1/0
[~DeviceB-GigabitEthernet0/1/0] undo shutdown
[*DeviceB-GigabitEthernet0/1/0] ip address 10.10.1.2 255.255.255.0
[*DeviceB-GigabitEthernet0/1/0] commit
[~DeviceB-GigabitEthernet0/1/0] return
<DeviceC> system-view
[~DeviceC] interface gigabitethernet0/1/0
[~DeviceC-GigabitEthernet0/1/0] undo shutdown
[*DeviceC-GigabitEthernet0/1/0] ip address 10.20.1.1 255.255.255.0
[*DeviceC-GigabitEthernet0/1/0] commit
[~DeviceC-GigabitEthernet0/1/0] return
# 启动OSPF协议,发布接口地址的路由。
<DeviceA> 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
<DeviceB> 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
<DeviceC> 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连接。
<DeviceA> 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
<DeviceB> 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连接。
<DeviceA> 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
<DeviceC> 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。
<DeviceB> system-view
[~DeviceB] ip ip-prefix bb permit 66.1.1.1 32
[*DeviceB] commit
[~DeviceB] return
# 配置路由发送端的路由策略。
<DeviceB> 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发布路由策略。
<DeviceB> 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策略,即关联的流行为。
<DeviceA> system-view
[~DeviceA] traffic behavior dd
[*DeviceA-behavior-dd] remark dscp af11
[*DeviceA-behavior-dd] commit
[~DeviceA-behavior-dd] return
# 配置路由接收策略,使匹配团体属性的路由应用关联的流行为。
<DeviceA> 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策略。
<DeviceA> 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发布过来的路由应用接收端路由策略。
<DeviceA> system-view
[~DeviceA] bgp 100
[*DeviceA-bgp] peer 2.2.2.2 route-policy aa import
[*DeviceA-bgp] commit
[~DeviceA-bgp] return
- 在接收端DeviceA上,流量的入接口上应用QPPB
<DeviceA> system-view
[~DeviceA] interface GigabitEthernet 0/2/0
[~DeviceA-GigabitEthernet0/2/0] qppb-policy ac source inbound
[*DeviceA-GigabitEthernet0/2/0] commit
[~DeviceA-GigabitEthernet0/2/0] return
- 检查配置结果
# 在DeviceA上显示QPPB本地策略的信息如下。
[~DeviceA] display qppb local-policy configuration ac
qppb local-policy: ac statistics disable service-class outbound disable is-used yes qos-local-id 1 behavior dd
配置文件
DeviceA的配置文件
# sysname DeviceA # interface GigabitEthernet0/1/0 undo shutdown ip address 10.20.1.2 255.255.255.0 # interface GigabitEthernet0/2/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 GigabitEthernet0/2/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 GigabitEthernet0/1/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