此为某大型企业的网,中间为骨干网,后缀为A的是电信网,后缀为B的是联通网。骨干网分布在北京、深圳、广州、天津。两侧为公司分部- - -西安和东莞
其中 XA(西安)和DG(东莞)通信有两种流量
业务:主走A面,A面故障走B面
办公:主走B面,B面故障走A面
两者通过不同的线路接入到不同的城市- - -可靠性高
以XA到DG为例
1.正常时XA到DG走A面
2.非正常时
1)当连接AS1和AS3的线路出现问题,XA到DG会切换到下面的线路,到达SZ-B,但是SZ-B并不会沿着IDC机房的线切换到本来该走的电信面,而是继续走联通面,因为联通面到达DG的AS-PATH比切换到电信面的AS-PATH短
不选local-pre是因为local-pre会传递给邻居,这样邻居切换回原面要绕路
2)DG返回XA时,流量走到原面(电信面)并不会沿着该面回去,而是会沿着IDC机房的线切换到联通面,因为EBGP>IBGP
不选metric是因为一个AS内的设备都设置metric的话,因为metric可以传递,IBGP邻居间会metric抵消,不会起控制选路的作用
注意:
在抓取打标签的流量时,抓取的是所有,包括所有分支打标签的流量,我们做策略也是针对于所有流量,做策略之后,会引起路径混乱
解决方法:
我们在抓取打标签的流量时,在骨干网中某城市节点应该去掉与自身建邻EBGP邻居的打标签分支流量,这样在一个面中就不会因为weight值被修改而导致的选weight而不选EBGP>IBGP而导致的绕路,致使数据层面和路由层面tracroute不一样
比如:
XA->BJ-A,我们需在BJ-A上剔除XA的业务流量,在BJ-B上剔除XA的办公流量,也就是不针对与XA的100.10.1.1/32和100.10.2.2/32路由做任何策略
BJ-A(config)#ip community-list 100 deny 1:10
BJ-A(config)#ip community-list 100 permit 1:*
BJ-B(config)#ip community-list 101 deny 2:10
BJ-B(config)#ip community-list 101 permit 2:*
抓取打标签的流量就是为了通过route-map来控制其流量走向
版权声明:本文为CSDN博主「飞儿呀」的原创文章,遵循CC 4.0 by-sa版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/weixin_43726831/article/details/98634984
*定义业务流量和办公流量
interface Loopback0
ip address 100.10.1.1 255.255.255.255
interface Loopback1
ip address 100.10.2.2 255.255.255.255
interface Serial2/0
ip address 100.1.1.1 255.255.255.0
interface Serial2/1
ip address 100.1.2.1 255.255.255.0
router bgp 3
bgp router-id 99.1.1.1
network 100.10.1.1 mask 255.255.255.255
network 100.10.2.2 mask 255.255.255.255
neighbor 100.1.1.2 remote-as 1
*开启传递团期属性,尽量选both
neighbor 100.1.1.2 send-community both //开启传递团期属性,尽量选both
neighbor 100.1.1.2 route-map A in
neighbor 100.1.1.2 route-map tag out
neighbor 100.1.2.2 remote-as 2
*开启传递团期属性,尽量选both
neighbor 100.1.2.2 send-community both
neighbor 100.1.2.2 route-map B in
neighbor 100.1.2.2 route-map tag out
*显示团体属性设置
ip bgp-community new-format
*匹配团体属性值
ip community-list expanded A permit ^1:*
ip community-list expanded B permit ^2:*
ip prefix-list A seq 5 permit 100.10.1.1/32
ip prefix-list B seq 5 permit 100.10.2.2/32
route-map A permit 10
match community A
set weight 100
route-map A permit 20
route-map B permit 10
match community B
set weight 100
route-map B permit 20
route-map tag permit 10
match ip address prefix-list A
set community 1:10
route-map tag permit 20
match ip address prefix-list B
set community 2:10
*定义业务流量和办公流量
interface Loopback0
ip address 100.20.1.1 255.255.255.255
interface Loopback1
ip address 100.20.2.2 255.255.255.255
interface Serial2/0
ip address 100.1.3.1 255.255.255.0
interface Serial2/1
ip address 100.1.4.1 255.255.255.0
router bgp 4
bgp router-id 99.2.2.2
network 100.20.1.1 mask 255.255.255.255
network 100.20.2.2 mask 255.255.255.255
neighbor 100.1.3.2 remote-as 1
*开启团体属性值 尽量选both
neighbor 100.1.3.2 send-community both
neighbor 100.1.3.2 route-map A in
neighbor 100.1.3.2 route-map tag out
neighbor 100.1.4.2 remote-as 2
*开启团体属性值 尽量选both
neighbor 100.1.4.2 send-community both
neighbor 100.1.4.2 route-map B in
neighbor 100.1.4.2 route-map tag out
ip bgp-community new-format
ip community-list expanded A permit ^1:*
ip community-list expanded B permit ^2:*
ip prefix-list A seq 5 permit 100.20.1.1/32
ip prefix-list B seq 5 permit 100.20.2.2/32
route-map A permit 10
match community A
set weight 100
route-map A permit 20
route-map B permit 10
match community B
set weight 100
route-map B permit 20
route-map tag permit 10
match ip address prefix-list A
set community 1:20
route-map tag permit 20
match ip address prefix-list B
set community 2:20
interface Loopback0
ip address 1.1.1.1 255.255.255.255
interface Ethernet0/0
ip address 10.12.1.1 255.255.255.0
interface Serial1/0
ip address 10.17.1.1 255.255.255.0
interface Serial1/1
ip address 10.13.1.1 255.255.255.0
interface Serial2/0
ip address 100.1.1.2 255.255.255.0
router eigrp 90
network 1.1.1.1 0.0.0.0
network 10.13.1.0 0.0.0.255
network 10.17.1.0 0.0.0.255
router bgp 1
bgp router-id 1.1.1.1
neighbor k peer-group
neighbor k remote-as 1
neighbor k update-source Loopback0
neighbor k next-hop-self
neighbor k send-community both
neighbor k route-map comm1 in
neighbor 3.3.3.3 peer-group k
neighbor 5.5.5.5 peer-group k
neighbor 7.7.7.7 peer-group k
neighbor 10.12.1.2 remote-as 2
neighbor 10.12.1.2 send-community both
neighbor 10.12.1.2 route-map comm in
neighbor 100.1.1.1 remote-as 3
neighbor 100.1.1.1 send-community both
ip bgp-community new-format
*此处为
ip community-list expanded A permit ^2:*
ip community-list expanded B deny 1:10
ip community-list expanded B permit ^1:*
*重点
route-map comm permit 10
match community A
set weight 100
route-map comm permit 20
route-map comm1 permit 10
match community B
set weight 100
route-map comm1 permit 20
interface Loopback0
ip address 2.2.2.2 255.255.255.255
interface Ethernet0/0
ip address 10.12.1.2 255.255.255.0
interface Serial1/0
ip address 10.28.1.1 255.255.255.0
interface Serial1/1
ip address 10.24.1.1 255.255.255.0
router eigrp 90
network 2.2.2.2 0.0.0.0
network 10.24.1.0 0.0.0.255
network 10.28.1.0 0.0.0.255
router bgp 2
bgp router-id 2.2.2.2
neighbor k peer-group
neighbor k remote-as 2
neighbor k update-source Loopback0
neighbor k next-hop-self
neighbor k send-community both
neighbor k route-map comm1 in
neighbor 4.4.4.4 peer-group k
neighbor 6.6.6.6 peer-group k
neighbor 8.8.8.8 peer-group k
neighbor 10.12.1.1 remote-as 1
neighbor 10.12.1.1 send-community both
neighbor 10.12.1.1 route-map comm in
ip bgp-community new-format
ip community-list expanded B deny 2:10
ip community-list expanded B permit ^2:*
ip community-list expanded A permit ^1:*
route-map comm permit 10
match community A
set weight 100
route-map comm permit 20
route-map comm1 permit 10
match community B
set weight 100
route-map comm1 permit 20
interface Loopback0
ip address 3.3.3.3 255.255.255.255
interface Ethernet0/0
ip address 10.34.1.1 255.255.255.0
interface Serial1/0
ip address 10.35.1.1 255.255.255.0
interface Serial1/1
ip address 10.13.1.2 255.255.255.0
router eigrp 90
network 3.3.3.3 0.0.0.0
network 10.13.1.0 0.0.0.255
network 10.35.1.0 0.0.0.255
router bgp 1
bgp router-id 3.3.3.3
neighbor k peer-group
neighbor k remote-as 1
neighbor k update-source Loopback0
neighbor k next-hop-self
neighbor k send-community both
neighbor k route-map comm1 in
neighbor 1.1.1.1 peer-group k
neighbor 5.5.5.5 peer-group k
neighbor 7.7.7.7 peer-group k
neighbor 10.34.1.2 remote-as 2
neighbor 10.34.1.2 send-community both
neighbor 10.34.1.2 route-map comm in
ip bgp-community new-format
ip community-list expanded A permit ^2:*
ip community-list expanded B deny 1:20
ip community-list expanded B permit ^1:*
route-map comm permit 10
match community A
set weight 100
route-map comm permit 20
route-map comm1 permit 10
match community B
set weight 100
route-map comm1 permit 20
interface Loopback0
ip address 4.4.4.4 255.255.255.255
interface Ethernet0/0
ip address 10.34.1.2 255.255.255.0
interface Serial1/0
ip address 10.46.1.1 255.255.255.0
interface Serial1/1
ip address 10.24.1.2 255.255.255.0
interface Serial2/0
ip address 100.1.4.2 255.255.255.0
router eigrp 90
network 4.4.4.4 0.0.0.0
network 10.24.1.0 0.0.0.255
network 10.46.1.0 0.0.0.255
router bgp 2
bgp router-id 4.4.4.4
neighbor k peer-group
neighbor k remote-as 2
neighbor k update-source Loopback0
neighbor k next-hop-self
neighbor k send-community both
neighbor k route-map comm1 in
neighbor 2.2.2.2 peer-group k
neighbor 6.6.6.6 peer-group k
neighbor 8.8.8.8 peer-group k
neighbor 10.34.1.1 remote-as 1
neighbor 10.34.1.1 send-community both
neighbor 10.34.1.1 route-map comm in
neighbor 100.1.4.1 remote-as 4
neighbor 100.1.4.1 send-community both
ip bgp-community new-format
ip community-list expanded A permit ^1:*
ip community-list expanded B deny 2:20
ip community-list expanded B permit ^2:*
route-map comm permit 10
match community A
set weight 100
route-map comm permit 20
route-map comm1 permit 10
match community B
set weight 100
route-map comm1 permit 20
interface Loopback0
ip address 7.7.7.7 255.255.255.255
interface Ethernet0/0
ip address 10.78.1.1 255.255.255.0
interface Serial1/1
ip address 10.57.1.1 255.255.255.0
router eigrp 90
network 7.7.7.7 0.0.0.0
network 10.17.1.0 0.0.0.255
network 10.57.1.0 0.0.0.255
router bgp 1
bgp router-id 7.7.7.7
neighbor k peer-group
neighbor k remote-as 1
neighbor k update-source Loopback0
neighbor k next-hop-self
neighbor k send-community both
neighbor k route-map comm1 in
neighbor 1.1.1.1 peer-group k
neighbor 3.3.3.3 peer-group k
neighbor 5.5.5.5 peer-group k
neighbor 10.78.1.2 remote-as 2
neighbor 10.78.1.2 send-community both
neighbor 10.78.1.2 route-map comm in
ip bgp-community new-format
ip community-list expanded A permit ^2:*
ip community-list expanded B deny 1:10
ip community-list expanded B permit ^1:*
route-map comm permit 10
match community A
set weight 100
route-map comm permit 20
route-map comm1 permit 10
match community B
set weight 100
route-map comm1 permit 20
interface Loopback0
ip address 8.8.8.8 255.255.255.255
interface Ethernet0/0
ip address 10.78.1.2 255.255.255.0
interface Serial1/0
ip address 10.28.1.2 255.255.255.0
interface Serial1/1
ip address 10.68.1.1 255.255.255.0
interface Serial2/0
ip address 100.1.2.2 255.255.255.0
router eigrp 90
network 8.8.8.8 0.0.0.0
network 10.28.1.0 0.0.0.255
network 10.68.1.0 0.0.0.255
router bgp 2
bgp router-id 8.8.8.8
neighbor k peer-group
neighbor k remote-as 2
neighbor k update-source Loopback0
neighbor k next-hop-self
neighbor k send-community both
neighbor k route-map comm1 in
neighbor 2.2.2.2 peer-group k
neighbor 4.4.4.4 peer-group k
neighbor 6.6.6.6 peer-group k
neighbor 10.78.1.1 remote-as 1
neighbor 10.78.1.1 send-community both
neighbor 10.78.1.1 route-map comm in
neighbor 100.1.2.1 remote-as 3
neighbor 100.1.2.1 send-community both
ip bgp-community new-format
ip community-list expanded A permit ^1:*
ip community-list expanded B deny 2:10
ip community-list expanded B permit ^2:*
route-map comm permit 10
match community A
set weight 100
route-map comm permit 20
route-map comm1 permit 10
match community B
set weight 100
route-map comm1 permit 20
interface Loopback0
ip address 5.5.5.5 255.255.255.255
interface Ethernet0/0
ip address 10.56.1.1 255.255.255.0
interface Serial1/0
ip address 10.57.1.2 255.255.255.0
interface Serial1/1
ip address 10.35.1.2 255.255.255.0
interface Serial2/0
ip address 100.1.3.2 255.255.255.0
router eigrp 90
network 5.5.5.5 0.0.0.0
network 10.35.1.0 0.0.0.255
network 10.57.1.0 0.0.0.255
router bgp 1
bgp router-id 5.5.5.5
neighbor k peer-group
neighbor k remote-as 1
neighbor k update-source Loopback0
neighbor k next-hop-self
neighbor k send-community both
neighbor k route-map comm1 in
neighbor 1.1.1.1 peer-group k
neighbor 3.3.3.3 peer-group k
neighbor 7.7.7.7 peer-group k
neighbor 10.56.1.2 remote-as 2
neighbor 10.56.1.2 send-community both
neighbor 10.56.1.2 route-map comm in
neighbor 100.1.3.1 remote-as 4
neighbor 100.1.3.1 send-community both
ip bgp-community new-format
ip community-list expanded A permit ^2:*
ip community-list expanded B deny 1:20
ip community-list expanded B permit ^1:*
route-map comm permit 10
match community A
set weight 100
route-map comm permit 20
route-map comm1 permit 10
match community B
set weight 100
route-map comm1 permit 20
interface Loopback0
ip address 6.6.6.6 255.255.255.255
interface Ethernet0/0
ip address 10.56.1.2 255.255.255.0
interface Serial1/0
ip address 10.68.1.2 255.255.255.0
interface Serial1/1
ip address 10.46.1.2 255.255.255.0
router eigrp 90
network 6.6.6.6 0.0.0.0
network 10.46.1.0 0.0.0.255
network 10.68.1.0 0.0.0.255
router bgp 2
bgp router-id 6.6.6.6
neighbor k peer-group
neighbor k remote-as 2
neighbor k update-source Loopback0
neighbor k next-hop-self
neighbor k send-community both
neighbor k route-map comm1 in
neighbor 2.2.2.2 peer-group k
neighbor 4.4.4.4 peer-group k
neighbor 8.8.8.8 peer-group k
neighbor 10.56.1.1 remote-as 1
neighbor 10.56.1.1 send-community both
neighbor 10.56.1.1 route-map comm in
ip bgp-community new-format
ip community-list expanded A permit ^1:*
ip community-list expanded B deny 2:20
ip community-list expanded B permit ^2:*
route-map comm permit 10
match community A
weight 100
route-map comm permit 20
route-map comm1 permit 10
match community B
set weight 100
route-map comm1 permit 20
1.传送团体属性时,因为所传递的值是扩展标记,需要用neighbor 10.56.1.1 send-community both
每一台路由器都需要ip bgp-community new-format,这样可以使团体值显示为正常所打的标记值