BGP双平面架构一般用于大型企业中,其冗余性极高,双平面指在运营商之中的骨干网络的拓扑设计,其拓扑规划图为平行六面体。
业务流量走电信,业务流量10.100.0.0/16
办公流量走联通,办公流量10.200.0.0/16
在西安(XA)和东莞(DG)分支上定义流量的走向,A面业务流量增大其Weight值在与A面路由器建邻时调用,B面同理。
此时由于BGP的选路规则,优选AS-path长度小的路径,其天然形成一种流量走向方案,业务流量进入电信后不会再次进入联通到达目标,办公流量进入联通后也不会再次进入电信到达目标
我们定义业务流量应该走A面(电信),当XA和BJ-A之间的线路故障时,XA走备份线路CD-B,但是进入B面的路由由于AS-path的原因不能回到A面,此时会导致A面流量走B面,与我们的设计不符,所以应该控制其回到A面,用BGP选路规则中排在AS-PATH之前的选路规则来控制其选路
Local_pref:会在IBGP之间传递,会影响其他B面路由器,不能选
MED:MED值,由于我们此时只是针对于一个分支节点XA的流量进行分析,该规划应为对称结构,骨干网连接很多分支,修改一个节点的MED值,其他节点必须修改,此时MED值会相互抵消,不能选
Next-hop&Origin&AS-Path:一般不做修改,公认必尊属性,它必然会传递到其他路由器,可能会影响其他路由器的正常选路
Weight:weight是最适合当下环境的属性,它不传递,只能影响自己,我们可以在CD-B上,抓取A面流量,增大其weight值,在CD-B与CD-A建邻时in方向调用,其必然回到A面
当DG->XA,此时由于XA和BJ-A之间的线路故障,会出现问题:即DG->XA有两条路径可选,且两条路AS-path长度一致,由于BGP的选路属性,对于相同的路由,EBGP传递过来的优于IBGP传递的,DG->XA的A面路由会通过B面传递,与我们原本设计不符
此时要控制其不走B面,走A面
同XA->DG路径分析原理一致,修改其weight
在SH-A上抓取A面流量,增大其weight,在于IBGP邻居建邻时调用
**定义业务和办公流量**
XA(config)#interface Loopback0
XA(config-if)#ip address 10.100.1.1 255.255.255.255
XA(config-if)#exit
XA(config)#interface Loopback1
XA(config-if)#ip address 10.200.1.1 255.255.255.255
XA(config-if)#exit
**XA-BJA**
XA(config)#interface Serial2/0
XA(config-if)#ip address 10.1.99.1 255.255.255.0
XA(config-if)#exit
**XA-CDB**
XA(config)#interface Serial2/1
XA(config-if)#ip address 10.2.99.1 255.255.255.0
XA(config-if)#exit
**BGP建邻**
XA(config)#router bgp 3
XA(config-router)#neighbor 10.1.99.2 remote-as 1
XA(config-router)#neighbor 10.2.99.2 remote-as 2
XA(config-router)#network 10.100.1.1 mask 255.255.255.255
XA(config-router)#network 10.200.1.1 mask 255.255.255.255
XA(config-router)#neighbor 10.1.99.2 send-community both
XA(config-router)#neighbor 10.1.99.2 send-community both
XA(config-if)#exit
**抓取流量**
XA(config)#ip prefix-list tag_a permit 10.100.1.1/32
XA(config)#ip prefix-list tag_b permit 10.200.1.1/32
**定义社团属性,打标签**
XA(config)#route-map tag permit 10
XA(config-route-map)#match ip address prefix-list tag_a
XA(config-route-map)#set community 100:1
XA(config-route-map)#exit
XA(config)#route-map tag permit 20
XA(config-route-map)#match ip address prefix-list tag_b
XA(config-route-map)#set community 200:1
XA(config-route-map)#exit
**送出标签**
XA(config)#router bgp 3
XA(config-router)#neighbor 10.1.99.2 route-map tag out
XA(config-router)#neighbor 10.2.99.2 route-map tag out
XA(config-router)#exit
**community扩展形式**
XA(config)#ip bgp-community new-format
**定义流量走向,增大weight**
XA(config)#ip community-list 100 permit 100:*
XA(config)#ip community-list 101 permit 200:*
XA(config)#route-map A permit 10
XA(config-route-map)#match community 100
XA(config-route-map)#set weight 100
XA(config-route-map)#exit
XA(config)#route-map A permit 20
XA(config-route-map)#exit
XA(config)#route-map B permit 10
XA(config-route-map)#match community 101
XA(config-route-map)#set weight 100
XA(config-route-map)#exit
XA(config)#route-map B permit 20
XA(config-route-map)#exit
**建邻时调用**
XA(config)#router bgp 3
XA(config-router)#neighbor 10.1.99.2 route-map A in
XA(config-router)#neighbor 10.2.99.2 route-map B in
XA(config-router)#exit
**定义业务和办公流量**
DG(config)#interface Loopback0
DG(config-if)#ip address 10.100.2.2 255.255.255.255
DG(config-if)#exit
DG(config)#interface Loopback1
DG(config-if)#ip address 10.200.2.2 255.255.255.255
DG(config-if)#exit
**DG-SHA**
DG(config)#interface Serial2/0
DG(config-if)#ip address 10.3.99.1 255.255.255.0
DG(config-if)#exit
**DG-SZB**
DG(config)#interface Serial2/1
DG(config-if)#ip address 10.4.99.1 255.255.255.0
DG(config-if)#exit
**BGP建邻**
DG(config)#router bgp 4
DG(config-router)#neighbor 10.3.99.2 remote-as 1
DG(config-router)#neighbor 10.4.99.2 remote-as 2
DG(config-router)#network 10.100.2.2 mask 255.255.255.255
DG(config-router)#network 10.200.2.2 mask 255.255.255.255
DG(config-router)#neighbor 10.3.99.2 send-community both
DG(config-router)#neighbor 10.4.99.2 send-community both
DG(config-if)#exit
**抓取流量**
DG(config)#ip prefix-list tag_a permit 10.100.2.2/32
DG(config)#ip prefix-list tag_b permit 10.200.2.2/32
**定义社团属性,打标签**
DG(config)#route-map tag permit 10
DG(config-route-map)#match ip address prefix-list tag_a
DG(config-route-map)#set community 100:2
DG(config-route-map)#exit
DG(config)#route-map tag permit 20
DG(config-route-map)#match ip address prefix-list tag_b
DG(config-route-map)#set community 200:2
DG(config-route-map)#exit
**送出标签**
DG(config)#router bgp 3
DG(config-router)#neighbor 10.3.99.2 route-map tag out
DG(config-router)#neighbor 10.4.99.2 route-map tag out
DG(config-router)#exit
**community扩展形式**
DG(config)#ip bgp-community new-format
**抓取打标签的流量**
DG(config)#ip community-list 100 permit 100:*
DG(config)#ip community-list 101 permit 200:*
**定义流量走向,增大weight**
DG(config)#route-map A permit 10
DG(config-route-map)#match community 100
DG(config-route-map)#set weight 100
DG(config-route-map)#exit
DG(config)#route-map A permit 20
DG(config-route-map)#exit
DG(config)#route-map B permit 10
DG(config-route-map)#match community 101
DG(config-route-map)#set weight 100
DG(config-route-map)#exit
DG(config)#route-map B permit 20
DG(config-route-map)#exit
**建邻时调用**
DG(config)#router bgp 3
DG(config-router)#neighbor 10.3.99.2 route-map A in
DG(config-router)#neighbor 10.4.99.2 route-map B in
DG(config-router)#exit
**环回建邻地址**
BJ-A(config)#interface loopback 0
BJ-A(config-if)#ip address 10.1.1.1 255.255.255.255
BJ-A(config-if)#exit
**BJ-A与SZ-A**
BJ-A(config)#interface s1/1
BJ-A(config-if)#ip address 10.1.15.1 255.255.255.0
BJ-A(config-if)#no shutdown
BJ-A(config-if)#exit
**BJ-A与CD-A**
BJ-A(config)#interface s1/0
BJ-A(config-if)#ip address 10.1.13.1 255.255.255.0
BJ-A(config-if)#no shutdown
BJ-A(config-if)#exit
**XA与BJ-A**
BJ-A(config)#interface s2/0
BJ-A(config-if)#ip address 10.1.99.2 255.255.255.0
BJ-A(config-if)#no shutdown
BJ-A(config-if)#exit
**BJ-A与BJ-B**
BJ-A(config)#interface e0/0
BJ-A(config-if)#ip address 10.1.12.1 255.255.255.0
BJ-A(config-if)#no shutdown
BJ-A(config-if)#exit
**底层IGP**
BJ-A(config)#router eigrp 1
BJ-A(config-router)#no auto-summary
BJ-A(config-router)#network 10.1.1.1 0.0.0.0
BJ-A(config-router)#network 10.1.15.0 0.0.0.255
BJ-A(config-router)#network 10.1.13.0 0.0.0.255
BJ-A(config-router)#exit
**BGP建邻**
BJ-A(config)#router bgp 1
BJ-A(config-router)#bgp router-id 10.1.1.1
BJ-A(config-router)#neighbor IBGP peer-group
BJ-A(config-router)#neighbor IBGP remote-as 1
BJ-A(config-router)#neighbor IBGP update-source loopback 0
BJ-A(config-router)#neighbor IBGP next-hop-self
BJ-A(config-router)#neighbor 10.3.3.3 peer-group IBGP
BJ-A(config-router)#neighbor 10.5.5.5 peer-group IBGP
BJ-A(config-router)#neighbor 10.7.7.7 peer-group IBGP
BJ-A(config-router)#neighbor 10.1.99.1 remote-as 3
BJ-A(config-router)#neighbor 10.1.12.2 remote-as 2
BJ-A(config-router)#neighbor IBGP send-community both
BJ-A(config-router)#neighbor 10.1.12.2 send-community both
BJ-A(config-router)#neighbor 10.1.99.1 send-community both
BJ-A(config-router)#exit
**开启community扩展形式**
BJ-A(config)#ip bgp-community new-format
**抓取打标签的流量**
BJ-A(config)#ip community-list 100 permit 100:*
BJ-A(config)#ip community-list 101 permit 200:*
**设置weight值**
BJ-A(config)#route-map A permit 10
BJ-A(config-route-map)#match community 100
BJ-A(config-route-map)#set weight 300
BJ-A(config-route-map)#exit
BJ-A(config)#route-map A permit 20
BJ-A(config-route-map)#exit
BJ-A(config)#route-map B permit 10
BJ-A(config-route-map)#match community 101
BJ-A(config-route-map)#set weight 200
BJ-A(config-route-map)#exit
BJ-A(config)#route-map B permit 20
BJ-A(config-route-map)#exit
**BGP建邻调用**
BJ-A(config)#router bgp 1
BJ-A(config-router)#neighbor IBGP route-map A in
BJ-A(config-router)#neighbor 10.1.12.2 route-map B in
BJ-A(config-router)#exit
**环回建邻地址**
BJ-B(config)#interface loopback 0
BJ-B(config-if)#ip address 10.2.2.2 255.255.255.255
BJ-B(config-if)#exit
**BJ-A与BJ-B**
BJ-B(config)#interface e0/0
BJ-B(config-if)#ip address 10.1.12.2 255.255.255.0
BJ-B(config-if)#no shutdown
BJ-B(config-if)#exit
**BJ-B与SZ-B**
BJ-B(config)#interface s1/1
BJ-B(config-if)#ip address 10.1.26.1 255.255.255.0
BJ-B(config-if)#no shutdown
BJ-B(config-if)#exit
**BJ-B与CD-B**
BJ-B(config)#interface s1/0
BJ-B(config-if)#ip address 10.1.24.1 255.255.255.0
BJ-B(config-if)#no shutdown
BJ-B(config-if)#exit
**底层IGP**
BJ-B(config)#router eigrp 2
BJ-B(config-router)#no auto-summary
BJ-B(config-router)#network 10.2.2.2 0.0.0.0
BJ-B(config-router)#network 10.1.26.0 0.0.0.255
BJ-B(config-router)#network 10.1.24.0 0.0.0.255
BJ-B(config-router)#exit
**BGP建邻**
BJ-B(config)#router bgp 2
BJ-B(config-router)#bgp router-id 10.2.2.2
BJ-B(config-router)#neighbor IBGP peer-group
BJ-B(config-router)#neighbor IBGP remote-as 2
BJ-B(config-router)#neighbor IBGP update-source loopback 0
BJ-B(config-router)#neighbor 10.4.4.4 peer-group IBGP
BJ-B(config-router)#neighbor 10.6.6.6 peer-group IBGP
BJ-B(config-router)#neighbor 10.8.8.8 peer-group IBGP
BJ-B(config-router)#neighbor IBGP next-hop-self
BJ-B(config-router)#neighbor 10.1.12.1 remote-as 1
BJ-B(config-router)#neighbor 10.1.12.1 send-community both
BJ-B(config-router)#neighbor IBGP send-community both
BJ-B(config-router)#exit
**打开community扩展模式**
BJ-B(config)#ip bgp-community new-format
**抓取打标签流量**
BJ-B(config)#ip community-list 100 permit 100:*
BJ-B(config)#ip community-list 101 permit 200:*
**设置weight值**
BJ-B(config)#route-map A permit 10
BJ-B(config-route-map)#match community 100
BJ-B(config-route-map)#set weight 200
BJ-B(config-route-map)#exit
BJ-B(config)#route-map A permit 20
BJ-B(config-route-map)#exit
BJ-B(config)#route-map B permit 10
BJ-B(config-route-map)#match community 101
BJ-B(config-route-map)#set weight 300
BJ-B(config-route-map)#exit
BJ-B(config)#route-map B permit 20
BJ-B(config-route-map)#exit
**建邻时调用**
BJ-B(config)#router bgp 2
BJ-B(config-router)#neighbor 10.1.12.1 route-map A in
BJ-B(config-router)#neighbor IBGP route-map B in
BJ-B(config-router)#exit
**环回建邻地址**
CD-A(config)#interface loopback 0
CD-A(config-if)#ip address 10.3.3.3 255.255.255.255
CD-A(config-if)#exit
**CD-A与SH-A**
CD-A(config)#interface s1/1
CD-A(config-if)#ip address 10.1.37.1 255.255.255.0
CD-A(config-if)#no shutdown
CD-A(config-if)#exit
**BJ-A与CD-A**
CD-A(config)#interface s1/0
CD-A(config-if)#ip address 10.1.13.2 255.255.255.0
CD-A(config-if)#no shutdown
CD-A(config-if)#exit
**CD-A与CD-B**
CD-A(config)#interface e0/0
CD-A(config-if)#ip address 10.1.34.1 255.255.255.0
CD-A(config-if)#no shutdown
CD-A(config-if)#exit
**底层IGP**
CD-A(config)#router eigrp 1
CD-A(config-router)#no auto-summary
CD-A(config-router)#network 10.3.3.3 0.0.0.0
CD-A(config-router)#network 10.1.37.0 0.0.0.255
CD-A(config-router)#network 10.1.13.0 0.0.0.255
CD-A(config-router)#exit
**BGP建邻**
CD-A(config)#router bgp 1
CD-A(config-router)#bgp router-id 10.3.3.3
CD-A(config-router)#neighbor IBGP peer-group
CD-A(config-router)#neighbor IBGP remote-as 1
CD-A(config-router)#neighbor IBGP update-source loopback 0
CD-A(config-router)#neighbor IBGP next-hop-self
CD-A(config-router)#neighbor 10.1.1.1 peer-group IBGP
CD-A(config-router)#neighbor 10.5.5.5 peer-group IBGP
CD-A(config-router)#neighbor 10.7.7.7 peer-group IBGP
CD-A(config-router)#neighbor 10.1.34.2 remote-as 2
CD-A(config-router)#neighbor IBGP send-community both
CD-A(config-router)#neighbor 10.1.34.2 send-community both
CD-A(config-router)#exit
**开启community扩展形式**
CD-A(config)#ip bgp-community new-format
**抓取打标签的流量**
CD-A(config)#ip community-list 100 permit 100:*
CD-A(config)#ip community-list 101 permit 200:*
**设置weight值**
CD-A(config)#route-map A permit 10
CD-A(config-route-map)#match community 100
CD-A(config-route-map)#set weight 300
CD-A(config-route-map)#exit
CD-A(config)#route-map A permit 20
CD-A(config-route-map)#exit
CD-A(config)#route-map B permit 10
CD-A(config-route-map)#match community 101
CD-A(config-route-map)#set weight 200
CD-A(config-route-map)#exit
CD-A(config)#route-map B permit 20
CD-A(config-route-map)#exit
**BGP建邻调用**
CD-A(config)#router bgp 1
CD-A(config-router)#neighbor IBGP route-map A in
CD-A(config-router)#neighbor 10.1.34.2 route-map B in
CD-A(config-router)#exit
**环回建邻地址**
CD-B(config)#interface loopback 0
CD-B(config-if)#ip address 10.4.4.4 255.255.255.255
CD-B(config-if)#exit
**CD-A与CD-B**
CD-B(config)#interface e0/0
CD-B(config-if)#ip address 10.1.34.2 255.255.255.0
CD-B(config-if)#no shutdown
CD-B(config-if)#exit
**CD-B与SH-B**
CD-B(config)#interface s1/1
CD-B(config-if)#ip address 10.1.48.1 255.255.255.0
CD-B(config-if)#no shutdown
CD-B(config-if)#exit
**BJ-B与CD-B**
CD-B(config)#interface s1/0
CD-B(config-if)#ip address 10.1.24.2 255.255.255.0
CD-B(config-if)#no shutdown
CD-B(config-if)#exit
**XA与CD-B**
CD-B(config)#interface s2/0
CD-B(config-if)#ip address 10.2.99.2 255.255.255.0
CD-B(config-if)#no shutdown
CD-B(config-if)#exit
**底层IGP**
CD-B(config)#router eigrp 2
CD-B(config-router)#no auto-summary
CD-B(config-router)#network 10.4.4.4 0.0.0.0
CD-B(config-router)#network 10.1.48.0 0.0.0.255
CD-B(config-router)#network 10.1.24.0 0.0.0.255
CD-B(config-router)#exit
**BGP建邻**
CD-B(config)#router bgp 2
CD-B(config-router)#bgp router-id 10.4.4.4
CD-B(config-router)#neighbor IBGP peer-group
CD-B(config-router)#neighbor IBGP remote-as 2
CD-B(config-router)#neighbor IBGP update-source loopback 0
CD-B(config-router)#neighbor 10.2.2.2 peer-group IBGP
CD-B(config-router)#neighbor 10.6.6.6 peer-group IBGP
CD-B(config-router)#neighbor 10.8.8.8 peer-group IBGP
CD-B(config-router)#neighbor IBGP next-hop-self
CD-B(config-router)#neighbor 10.1.34.1 remote-as 1
CD-B(config-router)#neighbor 10.2.99.1 remote-as 3
CD-B(config-router)#neighbor 10.1.34.1 send-community both
CD-B(config-router)#neighbor 10.2.99.1 send-community both
CD-B(config-router)#neighbor IBGP send-community both
CD-B(config-router)#exit
**打开community扩展模式**
CD-B(config)#ip bgp-community new-format
**抓取打标签流量**
CD-B(config)#ip community-list 100 permit 100:*
CD-B(config)#ip community-list 101 permit 200:*
**设置weight值**
CD-B(config)#route-map A permit 10
CD-B(config-route-map)#match community 100
CD-B(config-route-map)#set weight 200
CD-B(config-route-map)#exit
CD-B(config)#route-map A permit 20
CD-B(config-route-map)#exit
CD-B(config)#route-map B permit 10
CD-B(config-route-map)#match community 101
CD-B(config-route-map)#set weight 300
CD-B(config-route-map)#exit
CD-B(config)#route-map B permit 20
CD-B(config-route-map)#exit
**建邻时调用**
CD-B(config)#router bgp 2
CD-B(config-router)#neighbor 10.1.34.1 route-map A in
CD-B(config-router)#neighbor IBGP route-map B in
CD-B(config-router)#exit
**环回建邻地址**
SZ-A(config)#interface loopback 0
SZ-A(config-if)#ip address 10.5.5.5 255.255.255.255
SZ-A(config-if)#exit
**BJ-A与SZ-A**
SZ-A(config)#interface s1/1
SZ-A(config-if)#ip address 10.1.15.2 255.255.255.0
SZ-A(config-if)#no shutdown
SZ-A(config-if)#exit
**SZ-A与SH-A**
SZ-A(config)#interface s1/0
SZ-A(config-if)#ip address 10.1.57.1 255.255.255.0
SZ-A(config-if)#no shutdown
SZ-A(config-if)#exit
**SZ-A与SZ-B**
SZ-A(config)#interface e0/0
SZ-A(config-if)#ip address 10.1.56.1 255.255.255.0
SZ-A(config-if)#no shutdown
SZ-A(config-if)#exit
**底层IGP**
SZ-A(config)#router eigrp 1
SZ-A(config-router)#no auto-summary
SZ-A(config-router)#network 10.5.5.5 0.0.0.0
SZ-A(config-router)#network 10.1.57.0 0.0.0.255
SZ-A(config-router)#network 10.1.15.0 0.0.0.255
SZ-A(config-router)#exit
**BGP建邻**
SZ-A(config)#router bgp 1
SZ-A(config-router)#bgp router-id 10.5.5.5
SZ-A(config-router)#neighbor IBGP peer-group
SZ-A(config-router)#neighbor IBGP remote-as 1
SZ-A(config-router)#neighbor IBGP update-source loopback 0
SZ-A(config-router)#neighbor IBGP next-hop-self
SZ-A(config-router)#neighbor 10.1.1.1 peer-group IBGP
SZ-A(config-router)#neighbor 10.3.3.3 peer-group IBGP
SZ-A(config-router)#neighbor 10.7.7.7 peer-group IBGP
SZ-A(config-router)#neighbor 10.1.56.2 remote-as 2
SZ-A(config-router)#neighbor IBGP send-community both
SZ-A(config-router)#neighbor 10.1.56.2 send-community both
SZ-A(config-router)#exit
**开启community扩展形式**
SZ-A(config)#ip bgp-community new-format
**抓取打标签的流量**
SZ-A(config)#ip community-list 100 permit 100:*
SZ-A(config)#ip community-list 101 permit 200:*
**设置weight值**
SZ-A(config)#route-map A permit 10
SZ-A(config-route-map)#match community 100
SZ-A(config-route-map)#set weight 300
SZ-A(config-route-map)#exit
SZ-A(config)#route-map A permit 20
SZ-A(config-route-map)#exit
SZ-A(config)#route-map B permit 10
SZ-A(config-route-map)#match community 101
SZ-A(config-route-map)#set weight 200
SZ-A(config-route-map)#exit
SZ-A(config)#route-map B permit 20
SZ-A(config-route-map)#exit
**BGP建邻调用**
SZ-A(config)#router bgp 1
SZ-A(config-router)#neighbor IBGP route-map A in
SZ-A(config-router)#neighbor 10.1.56.2 route-map B in
SZ-A(config-router)#exit
**环回建邻地址**
SZ-B(config)#interface loopback 0
SZ-B(config-if)#ip address 10.6.6.6 255.255.255.255
SZ-B(config-if)#exit
**SZ-A与SZ-B**
SZ-B(config)#interface e0/0
SZ-B(config-if)#ip address 10.1.56.2 255.255.255.0
SZ-B(config-if)#no shutdown
SZ-B(config-if)#exit
**BJ-B与SZ-B**
SZ-B(config)#interface s1/1
SZ-B(config-if)#ip address 10.1.26.2 255.255.255.0
SZ-B(config-if)#no shutdown
SZ-B(config-if)#exit
**SZ-B与SH-B**
SZ-B(config)#interface s1/0
SZ-B(config-if)#ip address 10.1.68.1 255.255.255.0
SZ-B(config-if)#no shutdown
SZ-B(config-if)#exit
**DG与SZ-B**
SZ-B(config)#interface s2/0
SZ-B(config-if)#ip address 10.4.99.2 255.255.255.0
SZ-B(config-if)#no shutdown
SZ-B(config-if)#exit
**底层IGP**
SZ-B(config)#router eigrp 2
SZ-B(config-router)#no auto-summary
SZ-B(config-router)#network 10.6.6.6 0.0.0.0
SZ-B(config-router)#network 10.1.26.0 0.0.0.255
SZ-B(config-router)#network 10.1.68.0 0.0.0.255
SZ-B(config-router)#exit
**BGP建邻**
SZ-B(config)#router bgp 2
SZ-B(config-router)#bgp router-id 10.6.6.6
SZ-B(config-router)#neighbor IBGP peer-group
SZ-B(config-router)#neighbor IBGP remote-as 2
SZ-B(config-router)#neighbor IBGP update-source loopback 0
SZ-B(config-router)#neighbor 10.2.2.2 peer-group IBGP
SZ-B(config-router)#neighbor 10.4.4.4 peer-group IBGP
SZ-B(config-router)#neighbor 10.8.8.8 peer-group IBGP
SZ-B(config-router)#neighbor IBGP next-hop-self
SZ-B(config-router)#neighbor 10.1.56.1 remote-as 1
SZ-B(config-router)#neighbor 10.4.99.1 remote-as 4
SZ-B(config-router)#neighbor 10.1.56.1 send-community both
SZ-B(config-router)#neighbor 10.4.99.1 send-community both
SZ-B(config-router)#neighbor IBGP send-community both
SZ-B(config-router)#exit
**打开community扩展模式**
SZ-B(config)#ip bgp-community new-format
**抓取打标签流量**
SZ-B(config)#ip community-list 100 permit 100:*
SZ-B(config)#ip community-list 101 permit 200:*
**设置weight值**
SZ-B(config)#route-map A permit 10
SZ-B(config-route-map)#match community 100
SZ-B(config-route-map)#set weight 200
SZ-B(config-route-map)#exit
SZ-B(config)#route-map A permit 20
SZ-B(config-route-map)#exit
SZ-B(config)#route-map B permit 10
SZ-B(config-route-map)#match community 101
SZ-B(config-route-map)#set weight 300
SZ-B(config-route-map)#exit
SZ-B(config)#route-map B permit 20
SZ-B(config-route-map)#exit
**建邻时调用**
SZ-B(config)#router bgp 2
SZ-B(config-router)#neighbor 10.1.56.1 route-map A in
SZ-B(config-router)#neighbor IBGP route-map B in
SZ-B(config-router)#exit
**环回建邻地址**
SH-A(config)#interface loopback 0
SH-A(config-if)#ip address 10.7.7.7 255.255.255.255
SH-A(config-if)#exit
**SH-A与SZ-A**
SH-A(config)#interface s1/1
SH-A(config-if)#ip address 10.1.57.2 255.255.255.0
SH-A(config-if)#no shutdown
SH-A(config-if)#exit
**SH-A与CD-A**
SH-A(config)#interface s1/0
SH-A(config-if)#ip address 10.1.37.2 255.255.255.0
SH-A(config-if)#no shutdown
SH-A(config-if)#exit
**DG与SH-A**
SH-A(config)#interface s2/0
SH-A(config-if)#ip address 10.3.99.2 255.255.255.0
SH-A(config-if)#no shutdown
SH-A(config-if)#exit
**SH-A与SH-B**
SH-A(config)#interface e0/0
SH-A(config-if)#ip address 10.1.78.1 255.255.255.0
SH-A(config-if)#no shutdown
SH-A(config-if)#exit
**底层IGP**
SH-A(config)#router eigrp 1
SH-A(config-router)#no auto-summary
SH-A(config-router)#network 10.7.7.7 0.0.0.0
SH-A(config-router)#network 10.1.57.0 0.0.0.255
SH-A(config-router)#network 10.1.37.0 0.0.0.255
SH-A(config-router)#exit
**BGP建邻**
SH-A(config)#router bgp 1
SH-A(config-router)#bgp router-id 10.7.7.7
SH-A(config-router)#neighbor IBGP peer-group
SH-A(config-router)#neighbor IBGP remote-as 1
SH-A(config-router)#neighbor IBGP update-source loopback 0
SH-A(config-router)#neighbor IBGP next-hop-self
SH-A(config-router)#neighbor 10.3.3.3 peer-group IBGP
SH-A(config-router)#neighbor 10.5.5.5 peer-group IBGP
SH-A(config-router)#neighbor 10.1.1.1 peer-group IBGP
SH-A(config-router)#neighbor 10.3.99.1 remote-as 4
SH-A(config-router)#neighbor 10.1.78.2 remote-as 2
SH-A(config-router)#neighbor IBGP send-community both
SH-A(config-router)#neighbor 10.1.78.2 send-community both
SH-A(config-router)#neighbor 10.3.99.1 send-community both
SH-A(config-router)#exit
**开启community扩展形式**
SH-A(config)#ip bgp-community new-format
**抓取打标签的流量**
SH-A(config)#ip community-list 100 permit 100:*
SH-A(config)#ip community-list 101 permit 200:*
**设置weight值**
SH-A(config)#route-map A permit 10
SH-A(config-route-map)#match community 100
SH-A(config-route-map)#set weight 300
SH-A(config-route-map)#exit
SH-A(config)#route-map A permit 20
SH-A(config-route-map)#exit
SH-A(config)#route-map B permit 10
SH-A(config-route-map)#match community 101
SH-A(config-route-map)#set weight 200
SH-A(config-route-map)#exit
SH-A(config)#route-map B permit 20
SH-A(config-route-map)#exit
**BGP建邻调用**
SH-A(config)#router bgp 1
SH-A(config-router)#neighbor IBGP route-map A in
SH-A(config-router)#neighbor 10.1.78.2 route-map B in
SH-A(config-router)#exit
**环回建邻地址**
SH-B(config)#interface loopback 0
SH-B(config-if)#ip address 10.8.8.8 255.255.255.255
SH-B(config-if)#exit
**SH-A与SH-B**
SH-B(config)#interface e0/0
SH-B(config-if)#ip address 10.1.78.2 255.255.255.0
SH-B(config-if)#no shutdown
SH-B(config-if)#exit
**SH-B与SZ-B**
SH-B(config)#interface s1/1
SH-B(config-if)#ip address 10.1.68.2 255.255.255.0
SH-B(config-if)#no shutdown
SH-B(config-if)#exit
**SH-B与CD-B**
SH-B(config)#interface s1/0
SH-B(config-if)#ip address 10.1.48.2 255.255.255.0
SH-B(config-if)#no shutdown
SH-B(config-if)#exit
**底层IGP**
SH-B(config)#router eigrp 2
SH-B(config-router)#no auto-summary
SH-B(config-router)#network 10.8.8.8 0.0.0.0
SH-B(config-router)#network 10.1.48.0 0.0.0.255
SH-B(config-router)#network 10.1.68.0 0.0.0.255
SH-B(config-router)#exit
**BGP建邻**
SH-B(config)#router bgp 2
SH-B(config-router)#bgp router-id 10.8.8.8
SH-B(config-router)#neighbor IBGP peer-group
SH-B(config-router)#neighbor IBGP remote-as 2
SH-B(config-router)#neighbor IBGP update-source loopback 0
SH-B(config-router)#neighbor 10.4.4.4 peer-group IBGP
SH-B(config-router)#neighbor 10.2.2.2 peer-group IBGP
SH-B(config-router)#neighbor 10.6.6.6 peer-group IBGP
SH-B(config-router)#neighbor IBGP next-hop-self
SH-B(config-router)#neighbor 10.1.78.1 remote-as 1
SH-B(config-router)#neighbor 10.1.78.1 send-community both
SH-B(config-router)#neighbor IBGP send-community both
SH-B(config-router)#exit
**打开community扩展模式**
SH-B(config)#ip bgp-community new-format
**抓取打标签流量**
SH-B(config)#ip community-list 100 permit 100:*
SH-B(config)#ip community-list 101 permit 200:*
**设置weight值**
SH-B(config)#route-map A permit 10
SH-B(config-route-map)#match community 100
SH-B(config-route-map)#set weight 200
SH-B(config-route-map)#exit
SH-B(config)#route-map A permit 20
SH-B(config-route-map)#exit
SH-B(config)#route-map B permit 10
SH-B(config-route-map)#match community 101
SH-B(config-route-map)#set weight 300
SH-B(config-route-map)#exit
SH-B(config)#route-map B permit 20
SH-B(config-route-map)#exit
**建邻时调用**
SH-B(config)#router bgp 2
SH-B(config-router)#neighbor 10.1.78.1 route-map A in
SH-B(config-router)#neighbor IBGP route-map B in
SH-B(config-router)#exit
原因:在抓取打标签的流量时,抓取的是所有,包括所有分支打标签的流量,我们做策略也是针对于所有流量,做策略之后,会引起路径混乱
解决方法:我们在抓取打标签的流量时,在骨干网中某城市节点应该去与自身建邻EBGP邻居的打标签分支流量
比如:
XA->BJ-A,我们需在BJ-A上剔除XA的业务流量,在BJ-B上剔除XA的办公流量,也就是不针对与XA的10.100.1.1/32和10.200.1.1/32路由做任何策略
BJ-A(config)#ip community-list 100 deny 100:1
BJ-A(config)#ip community-list 100 permit 100:*
BJ-B(config)#ip community-list 101 deny 200:1
BJ-B(config)#ip community-list 101 permit 200:*
抓取打标签的流量就是为了通过route-map来控制其流量走向