BGP 双平面业务分流

在这里插入图片描述
bgp双平面
目的:使XA到DG的业务流量走A面,办公流量走B面。同时,在XA到BJ-A线路断裂后业务流量走到CD-B后向上走CD-A,依旧通过A面到DG。
同理也实现线路断裂后办公流量就近走到B面。依旧通过B面到DG。
DG也同样实现到XA的不同流量走不同面。线路断裂后就近到相应的流量面到达目的。
可对业务和办公路由设置社团属性,在中间bgp上发送社团属性做到路由的标记。
DG的10.200.1.1/32 为1:10 10.200.2.1/32 为 2:10
XA的10.100.1.1/32 为 1:9 10.100.2.1/32 为2:9
在XA和DG上可通过修改bgp的weight值或local-pre来做到相应流量走相应的面:
DG#show ip community-list
Named Community expanded list a 抓取1:10和1:9的业务路由
permit ^1:*
Named Community expanded list b 抓取2:10和2:9的办公路由
permit ^2:*
DG#show run | s route-map
neighbor 10.99.3.5 route-map a in SH-A发来的路由调用route-map a
neighbor 10.99.3.5 route-map com out
neighbor 10.99.4.4 route-map b in SZ-B发来的路由钓友route-map b
neighbor 10.99.4.4 route-map com out
route-map com permit 10 发送业务路由时发送社团属性1:10
match ip address prefix-list a
set community 1:10
route-map com permit 20
match ip address prefix-list b 发送办公路由时发送社团属性2:10
set community 2:10
route-map a permit 10 在接收SH-A发来的a面路由时设置weight为10
match community a
set weight 10
route-map a permit 20
route-map b permit 10 在接收SZ-B发来的b面路由时设置weight为10
match community b
set weight 10
route-map b permit 20
DG#show run | s bgp
router bgp 4
bgp router-id 10.10.10.10
bgp log-neighbor-changes
network 10.10.10.10 mask 255.255.255.255
network 10.200.1.1 mask 255.255.255.255
network 10.200.2.1 mask 255.255.255.255
neighbor 10.99.3.5 remote-as 1
neighbor 10.99.3.5 send-community both 发送社团属性
neighbor 10.99.3.5 route-map a in 在和SH-A邻居的in方向调用route-map a
neighbor 10.99.3.5 route-map com out
neighbor 10.99.4.4 remote-as 2
neighbor 10.99.4.4 send-community both
neighbor 10.99.4.4 route-map b in 在和SZ-B邻居的in方向调用route-map b
neighbor 10.99.4.4 route-map com out
ip bgp-community new-format //显示新的社团属性格式
做完策略后的bgp路由:

XA同理:
做完策略后的路由:

配置:
CD-B将CD-A发来的A面路由weight值设置为10:

做完策略后的bgp路由为:

SZ-B和CD-B配置相同。Bgp路由为:

BJ-A将BJ-B发来的B面路由weight设置为10:

Bgp路由为:

SH-A和BJ-A配置相同
SH-A的BGP路由为:

测试:
1.在XA上以10.100.1.1为源traceroute 10.200.1.1

断开e0/0口后:

在XA上以10.100.2.1为源traceroute 10. 200.2.1

断开e0/1口后

在DG上以10.200.1.1为源 traceroute 10.100.1.1

断开e0/1口

以10.200.2.1为源traceroute 10.100.2.1

断开e0/0口

总结:在这个bgp双平面的问题上,业务路由传到A面因为AS-PATH A面路由器必定优选A面,同理办公路由传到B面的路由器上,B面路由器必定优选B面。
A面路由通过B面传到A面后因为AS-PATH 所以必定不优,而调整优先级,可以使用的只能为weight或 local-pre ,但是使用local-pre会导致所有A面去办公的路由去A面的一个路由器再下到B面,而不是就近到达B面。故只能使用weight值做策略。
在XA和DG上,如果XA或DG的AS中还有其他BGP路由器的话 ,使用local-pre比较方便。
因为本拓扑只有一个路由器,所以可以用weight值做策略。在这里插入图片描述