十八、CCNP-BGP(路由反射器/联邦)

18.5 BGP路由反射器/联邦

18.5.1 背景

三个AS号,中间的AS为中转AS。BCDE间运行OSPF,让BCDE间互通,也为BGP邻居关系的建立提供平台,因为BGP是基于TCP建的,并不要求是直连,但是得有路由。其中CD只运行了OSPF,BE既运行了OSPF,又运行了BGP,BE建建立了IBGP邻居关系。为了规避路由黑洞:

  1. 可以考虑把BGP路由重发布进OSPF里面,但存在风险,因为BGP路由协议大,容易把OSPF撑死。
  2. 还可以考虑让CD也运行BGP协议,则BD、BC、DE、CE都需要建立邻居关系,由于存在IBGP水平分割原则(BGP防环基于AS-PATH,但是AS-PATH是基于AS间的,在AS内部不起作用,所以需要IBGP水平分割规则来防环),当路由器D和C从IBGP邻居B学到路由后,则不将该路由发送给任何C、D的IBGP邻居E,导致E学不到路由。

基于此,则需要BCDE间两两都建立邻居关系,即FULL MESH。

18.5.2 BGP反射器:Reflector

18.5.2.1 技术背景

既不想在R3和R5间建立IBGP邻居关系,又想路由R5能学到路由。

R3为CLIENT,R4为ROUTE REFLECTOR,R3和R4形成簇。

注意,是否是CLIENT,是在RR上配置的。

18.5.2.2 规则

从R3学过来的,会反射给R4和R5

从R3学过来的,则反射被R4,不给R5.

从R1学过来的,则发送给R3、R4和R5

18.5.2.3 防环

AS_PATH在AS间,AS内部AS_PATH是不会变的,这时AS_PATH的防环作用就消失了。

  • R3给R4的时候是没有ORIGINATOR_ID和CLUSTER_LIST的,当R4范设给R5是,会在路由上的BGP属性增加ORIGINATOR_ID和CLUSTER_LIST。
  • ORIGINATOR_ID表示路由起源,此处是R3,所以为3.3.3.3。当给R5的路由由于某种原因传给R3时,R3就能发现ORIGINATOR_ID为自己,就知道存在环路了,就忽略。
  • CLUSTER_LIST表示簇ID,默认情况下为RR的地址,当R5也是RR时,当路由发发回给R4时,R5会在CLUSTER_LIST中添加自己的ID,如5.5.5.5。这时R4收到时发现CLUSTER_LIST里面有自己的4.4.4.4,认为存在环路,就忽略。
18.5.2.3.1 Originator_ID

如果R2有一条2.0的本地始发路由,发给R3,R3收到一条来自非CLINET路由,则发射被CLIENT客户R4,反射的时候添加ORG_ID,为R2的ROUTER-ID。

如果路由来自AS外部,如R1,传递给EBGP邻居R2,再由R2给R3,ORG_ID还是R2,不能是R1,因为需要在AS内部。

18.5.2.3.2 Cluster_list

R3即使RR也是CLIENT。

R3收到R1后反射给R4。R4上增加了路径属性,ORIGIN为R1,CLUSTER_LIST经过R3反射,R3反射时放上ORGIN和自己的ROUTER-ID。

由于R4也是RR,R4就会进一步反射给R5。

R5从两个方向收到R1的路由

  1. 从R4方向过来的,ORIGIN不变,修改了CLUSTER_LIST,增加了自己的ROUTE-ID。
  2. 从R2方向过来的,ORIGIN为R1,CLUSTER_LIST新增R2的ROUTE-ID。

所以此处有三个反射簇,一个是R1、R2,一个是R1、R3,一个是R3、R4。最终R5学到两条路由,最终优选BEST是由R2发送过来的。其他因素相同的情况下,CLISTER_LIST长度决定选路优先级。

路径属性,里面有CLUSTER_LIST         、ORIGINATOR_ID等。

18.5.2.3.3 冗余

一旦RR挂掉了,水平分割原则存在而学不到路由了。

CLIENT不知道谁是RR,所有会发给自己所有的IBGP邻居,两个RR收到后,会发射给CLIENT,

两个RR的CLUSTER_ID一样,则CLISTER_LIST中判断存在一样。

18.5.2.4 配置

R3R4R5运行OSPF,R3R4维护IBGP邻居关系,R4R5维护IBGP邻居关系,

18.5.2.4.1 基础配置

R1路由器接口和LOOPBACK地址配置

R1(config)#interface serial 0/0
R1(config-if)#ip address 10.1.13.1 255.255.255.00
R1(config-if)#no shutdown
R1(config)#interface loopback 0
R1(config-if)#ip address 1.1.1.1 255.255.255.0
R1(config-if)#no shutdown
R1(config)#interface loopback 1
R1(config-if)#ip address 100.0.1.1 255.255.255.0
R1(config-if)#no shutdown
R1(config)#interface loopback 2
R1(config-if)#ip address 100.0.1.1 255.255.255.0
R1(config-if)#no shutdown

R1建立EBGP邻居关系,并宣告LP路由

R1(config)#router bgp 100
R1(config-router)#neighbor 10.1.13.3 remote-as 345
R1(config-router)#network 100.0.1.0 mask 255.255.255.0
R1(config-router)#network 100.0.2.0 mask 255.255.255.0

R2路由器接口和LOOPBACK地址配置

R2(config)#interface serial 0/0
R2(config-if)#ip address 10.1.25.2 255.255.255.0
R2(config-if)#no shutdown
R2(config)#interface loopback 0
R2(config-if)#ip address 2.2.2.2 255.255.255.0
R2(config-if)#no shutdown

R2建立EBGP邻居

R2(config)#router bgp 200
R2(config-router)#neighbor 10.1.25.5 remote-as 345

R3路由器接口和LOOPBACK地址配置

R3(config)#interface serial 0/0
R3(config-if)#ip address 10.1.13.3 255.255.255.0
R3(config-if)#no shutdown
R3(config)#interface serial 0/1
R3(config-if)#ip address 10.1.34.3 255.255.255.0
R3(config-if)#no shutdown
R3(config)#interface loopback 0
R3(config-if)#ip address 3.3.3.3 255.255.255.0
R3(config-if)#no shutdown

R3运行OSPF进程

R3(config)#router ospf 1
R3(config-router)#network 10.1.34.3 0.0.0.0 area 0
R3(config-router)#network 3.3.3.3 0.0.0.0 area 0

R3和R1建立EBGP邻居关系和R4建立IBGP邻居关系

R3(config)#router bgp 345
R3(config-router)#neighbor 10.1.13.1 remote-as 100
R3(config-router)#neighbor 4.4.4.4 remote-as 345
R3(config-router)#neighbor 4.4.4.4 update-source loopback 0

注意,IGP中不宣告AS间链路,所以需要再R3上做NEXT-HOP-SELF

R3(config-router)#neighbor 4.4.4.4 next-hop-self

R4路由器接口和LOOPBACK地址配置

R4(config)#interface serial 0/0
R4(config-if)#ip address 10.1.34.4 255.255.255.0
R4(config-if)#no shutdown
R4(config)#interface serial 0/1
R4(config-if)#ip address 10.1.45.4 255.255.255.0
R4(config-if)#no shutdown
R4(config)#interface loopback 0
R4(config-if)#ip address 4.4.4.4 255.255.255.0
R4(config-if)#no shutdown

R4的OSPF配置

R4(config)#router ospf 1
R4(config-router)#network 10.1.34.4 0.0.0.0 area 0
R4(config-router)#network 10.1.45.4 0.0.0.0 area 0
R4(config-router)#network 4.4.4.4 0.0.0.0 area 0

R4的BGP配置

R4(config)#router bgp 345
R4(config-router)#neighbor 3.3.3.3 remote-as 345
R4(config-router)#neighbor 3.3.3.3 update-source loopback 0
R4(config-router)#neighbor 5.5.5.5 remote-as 345
R4(config-router)#neighbor 5.5.5.5 update-source loopback 0

R5路由器接口和LOOPBACK地址配置

R5(config)#interface serial 0/0
R5(config-if)#ip address 10.1.45.5 255.255.255.0
R5(config-if)#no shut
R5(config)#interface serial 0/1
R5(config-if)#ip address 10.1.25.5 255.255.255.0
R5(config-if)#no shutdown
R5(config)#interface loopback 0
R5(config-if)#ip address 5.5.5.5 255.255.255.0
R5(config-if)#no shutdown

R5运行OSPF进程

R5(config)#router ospf 1
R5(config-router)#network 10.1.45.5 0.0.0.0 area 0
R5(config-router)#network 5.5.5.5 0.0.0.0 area 0

R5和R1建立EBGP邻居关系和R4建立IBGP邻居关系

R5(config)#router bgp 345
R5(config-router)#neighbor 4.4.4.4 remote-as 345
R5(config-router)#neighbor 4.4.4.4 update-source loopback 0
R5(config-router)#neighbor 10.1.25.2 remote-as 200
18.5.2.4.2 反射器
R3#show ip bgp
BGP table version is 3, local router ID is 3.3.3.3
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 100.0.1.0/24     10.1.13.1                0             0 100 i
*> 100.0.2.0/24     10.1.13.1                0             0 100 i

目前为止,R3收到了两条LP1和LP2路由

R4#show ip bgp
BGP table version is 7, local router ID is 4.4.4.4
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*>i100.0.1.0/24     3.3.3.3                  0    100      0 100 i
*>i100.0.2.0/24     3.3.3.3                  0    100      0 100 i

R4去往两个路由的下一跳为3.3.3.3

R5#show ip bgp

R5的路由是空的,因为R4从R3学到,由于水平分割规则,不会传递给R5。

将R3作为CLIENT,R4作为RR。R3R4构成路由反射簇

R4(config)#router bgp 345
R4(config-router)#neighbor 3.3.3.3 route-reflector-client
R5#show ip bgp
BGP table version is 3, local router ID is 5.5.5.5
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*>i100.0.1.0/24     3.3.3.3                  0    100      0 100 i
*>i100.0.2.0/24     3.3.3.3                  0    100      0 100 i

这时R5就已经有路由了。

R5#show ip bgp 100.0.1.0
BGP routing table entry for 100.0.1.0/24, version 2
Paths: (1 available, best #1, table Default-IP-Routing-Table)
Flag: 0x820
  Advertised to update-groups:
     2
  100
    3.3.3.3 (metric 129) from 4.4.4.4 (4.4.4.4)
      Origin IGP, metric 0, localpref 100, valid, internal, best
      Originator: 3.3.3.3, Cluster list: 4.4.4.4

明细,ORGINATOR是R3,CLUSTER_LIST有R4,默认为R4的ID

R4(config)#router bgp 345
R4(config-router)#bgp cluster-id 44.44.44.44

修改R4的ID

R5#show ip bgp 100.0.1.0
BGP routing table entry for 100.0.1.0/24, version 4
Paths: (1 available, best #1, table Default-IP-Routing-Table)
Flag: 0x820
  Advertised to update-groups:
     2
  100
    3.3.3.3 (metric 129) from 4.4.4.4 (4.4.4.4)
      Origin IGP, metric 0, localpref 100, valid, internal, best
      Originator: 3.3.3.3, Cluster list: 44.44.44.44

可以看到CLUSTER_LIST也随之修改了。

当然也可以把R5作为CLIENT,R4依旧做RR。但是如果R4为CLIENT,R5为RR,则R5将学不到路由,因为R4是不知道自己是CLIENT,只有R5才知道,R4作为CLIENT普通路由器,根据水平分割规则,是不能传递给R5的。

18.5.3 BGP联邦:Confederation

18.5.3.1 介绍

联邦AS,内部可以进一步划分联邦小AS(成员AS),这时R1传给EBGP邻居R3,R3传给联邦IBGP邻居R4,R4传给联邦EBGP邻居R5,R5传给EBGP邻居R2。联邦成员AS号只在AS内部有效,外部不可见。

18.5.3.2 配置

18.5.3.2.1 基础配置

R1路由器配置

R1(config)#interface serial 0/0
R1(config-if)#ip address 10.1.13.1 255.255.255.0
R1(config-if)#no shutdown
R1(config)#interface loopback 0
R1(config-if)#ip address 1.1.1.1 255.255.255.0
R1(config-if)#no shutdown
R1(config)#interface loopback 1
R1(config-if)#ip address 100.0.1.1 255.255.255.0
R1(config-if)#no shutdown
R1(config)#interface loopback 2
R1(config-if)#ip address 100.0.2.1 255.255.255.0
R1(config-if)#no shutdown

BGP配置,不收联邦内部影响

R1(config)#router bgp 100
R1(config-router)#neighbor 10.1.13.3 remote-as 345
R1(config-router)#network 100.0.1.0 mask 255.255.255.0
R1(config-router)#network 100.0.2.0 mask 255.255.255.0

R2配置

R2(config)#interface serial 0/0
R2(config-if)#ip address 10.1.25.2 255.255.255.0
R2(config-if)#no shutdown
R2(config)#interface loopback 0
R2(config-if)#ip address 2.2.2.2 255.255.255.0
R2(config-if)#no shutdown

R2暂时先不宣告LP路径进BGP

R2(config)#router bgp 200
R2(config-router)#neighbor 10.1.25.5 remote-as 345
R2(config-router)#bgp router-id 2.2.2.2

R3配置

R3(config)#interface serial 0/0
R3(config-if)#ip address 10.1.13.3 255.255.255.0
R3(config-if)#no shutdown
R3(config)#interface serial 0/1
R3(config-if)#ip address 10.1.34.3 255.255.255.0
R3(config-if)#no shutdown
R3(config)#interface loopback 0
R3(config-if)#ip address 3.3.3.3 255.255.255.0
R3(config-if)#no shutdown

联邦内部跑OSPF,把各自LP0宣告进OSPF。

R3(config)#router ospf 1
R3(config-router)#router-id 3.3.3.3
R3(config-router)#network 10.1.34.3 0.0.0.0 area 0
R3(config-router)#network 3.3.3.3 0.0.0.0 area 0

R4配置

R4(config)#interface serial 0/0
R4(config-if)#ip address 10.1.34.4 255.255.255.0
R4(config-if)#no shutdown
R4(config)#interface serial 0/1
R4(config-if)#ip address 10.1.45.4 255.255.255.0
R4(config-if)#no shutdown
R4(config)#interface loopback 0
R4(config-if)#ip address 4.4.4.4 255.255.255.0
R4(config-if)#no shutdown

R4配置OSPF

R4(config)#router ospf 1
R4(config-router)#network 10.1.34.4 0.0.0.0 area 0
R4(config-router)#network 10.1.45.4 0.0.0.0 area 0
R4(config-router)#network 4.4.4.4 0.0.0.0 area 0

R5配置

R5(config)#interface serial  0/0
R5(config-if)#ip address 10.1.45.5 255.255.255.0
R5(config-if)#no shutdown
R5(config)#interface serial 0/1
R5(config-if)#ip address 10.1.25.5 255.255.255.0
R5(config-if)#no shutdown
R5(config)#interface loopback 0
R5(config-if)#ip address 5.5.5.5 255.255.255.0
R5(config-if)#no shutdown

R5的OSPF配置

R5(config)#router ospf 1
R5(config-router)#network 10.1.45.5 0.0.0.0 area 0
R5(config-router)#network 5.5.5.5 0.0.0.0 area 0
R3#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

     3.0.0.0/24 is subnetted, 1 subnets
C       3.3.3.0 is directly connected, Loopback0
     4.0.0.0/32 is subnetted, 1 subnets
O       4.4.4.4 [110/65] via 10.1.34.4, 00:01:32, Serial0/1
     5.0.0.0/32 is subnetted, 1 subnets
O       5.5.5.5 [110/129] via 10.1.34.4, 00:01:32, Serial0/1
     10.0.0.0/24 is subnetted, 3 subnets
C       10.1.13.0 is directly connected, Serial0/0
O       10.1.45.0 [110/128] via 10.1.34.4, 00:01:32, Serial0/1
C       10.1.34.0 is directly connected, Serial0/1

R3通过OSPF也能学到R5的路由

至此基本配置完成,R3和R5没有宣告OSPF的外部路径

18.5.3.2.2 BGP联邦配置

R3用联邦成员AS号创建进程

R3(config)#router bgp 64512
R3(config-router)#bgp router-id 3.3.3.3
R3(config-router)#bgp confederation identifier 345
R3(config-router)#neighbor 10.1.13.1 remote-as 100
R3(config-router)#neighbor 4.4.4.4 remote-as 64512
R3(config-router)#neighbor 4.4.4.4 update-source loopback 0

R4除了和R3建IBGP,还需要和R4建EBGP,

注意EBGP会检查TTL,默认是1,需要修改。

R4(config)#router bgp 64512
R4(config-router)#bgp router-id 4.4.4.4
R4(config-router)#bgp confederation identifier 345
R4(config-router)#bgp confederation peers 64513
R4(config-router)#neighbor 3.3.3.3 remote-as 64512
R4(config-router)#neighbor 3.3.3.3 update-source loopback 0
R4(config-router)#neighbor 5.5.5.5 remote-as 64513
R4(config-router)#neighbor 5.5.5.5 update-source loopback 0
R4(config-router)#neighbor 5.5.5.5 ebgp-multihop 3

注意,此处可以直接社会自neighbor 5.5.5.5 ebgp-multihop,不用设置具体3

R5(config)#router bgp 64513
R5(config-router)#bgp router-id 5.5.5.5
R5(config-router)#bgp confederation identifier 345
R5(config-router)#bgp confederation peers 64512
R5(config-router)#neighbor 4.4.4.4 remote-as 64512
R5(config-router)#neighbor 4.4.4.4 update-source loopback 0
R5(config-router)#neighbor 4.4.4.4 ebgp-multihop 4
R5(config-router)#neighbor 10.1.25.2 remote-as 200

注意,此处可以直接社会自neighbor 4.4.4.4 ebgp-multihop,不用设置具体4

18.5.3.2.3 试验1:NEXT HOP变化

NEXT HOP在EBGP间传递时会变,在AS内部不变。

但是在联邦AS内EBGP邻居NEXTHOP就不会发生变化。

直到出AS,传统EBGP后,才会变NEXT HOP。

R3#show ip bgp
BGP table version is 3, local router ID is 3.3.3.3
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 100.0.1.0/24     10.1.13.1                0             0 100 i
*> 100.0.2.0/24     10.1.13.1                0             0 100 i

R3上能看到R1传过来的路由,期NEXT HOP都是R1的连接节点地址。

R4#show ip bgp
BGP table version is 3, local router ID is 4.4.4.4
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
* i100.0.1.0/24     10.1.13.1                0    100      0 100 i
* i100.0.2.0/24     10.1.13.1                0    100      0 100 i

R3传给R4时,NEXT HOP 没变化,路由不是BEXT,因为10.13.1不可达。

为了查看演示效果,将R1、R3的链路宣告进

R3(config)#router ospf 1
R3(config-router)#network 10.1.13.3 0.0.0.0 area 0
R4#show ip bgp
BGP table version is 5, local router ID is 4.4.4.4
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*>i100.0.1.0/24     10.1.13.1                0    100      0 100 i
*>i100.0.2.0/24     10.1.13.1                0    100      0 100 i

现在看到的就是BEST路由了。

优化后,则可传递。

R5#show ip bgp
BGP table version is 3, local router ID is 5.5.5.5
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 100.0.1.0/24     10.1.13.1                0    100      0 (64512) 100 i
*> 100.0.2.0/24     10.1.13.1                0    100      0 (64512) 100 i

R4传递给R5,NEXT HOP 不变。

18.5.3.2.4 试验2:MED属性

传统AS间,MED值不会传出本AS。

联邦内,R4到R5跨AS间的MED值也会保留。

R5到R2,跨传统AS,则MED为空。

R1(config)#ip prefix-list 1 permit 100.0.1.0/24
R1(config)#route-map test permit 10
R1(config-route-map)#match ip address prefix-list 1
R1(config-route-map)#set metric 111

R1(config)#router bgp 100
R1(config-router)#neighbor 10.1.13.3 route-map test out
R3#show ip bgp
BGP table version is 5, local router ID is 3.3.3.3
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 100.0.1.0/24     10.1.13.1              111             0 100 i

此时R3只有一条路由了,对应METRIC值为111,ROUTE-MAP只放行一条路由。

R4#show ip bgp
BGP table version is 7, local router ID is 4.4.4.4
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*>i100.0.1.0/24     10.1.13.1              111    100      0 100 i

R3传递给R4,R4的METRIC值也是111

R5#show ip bgp
BGP table version is 5, local router ID is 5.5.5.5
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 100.0.1.0/24     10.1.13.1              111    100      0 (64512) 100 i

R4传给R5,METRIC值也保留了,没有清空。

R2#show ip bgp
BGP table version is 4, local router ID is 2.2.2.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 100.0.1.0/24     10.1.25.5                              0 345 100 i

R5传给R2的METRIC值就为空了

18.5.3.2.5 试验3:LOCAL_PREFREENCE属性

传统的EBGP邻居关系,LOCAL_PRE只能在AS内部传递,不能在AS间传递。

R1给R3发,不能在OUT方向做策略,设置LOCAL_PRE。但是R3可以做IN方向的策略,设置LOCAL_PRE。

清除之前位置

R1(config)#no route-map test
R1(config-router)#no neighbor 10.1.13.3 route-map test out

在R3的IN方向做ROUTE-MAP,设置LOCAL_PREFERENCE。

R3(config)#ip prefix-list 1 permit 100.0.1.0/24
R3(config)#route-map test permit 10
R3(config-route-map)#match ip address prefix-list 1
R3(config-route-map)#set local-preference 111

R3(config)#router bgp 64512
R3(config-router)#neighbor 10.1.13.1 route-map test in
R3#show ip bgp
BGP table version is 9, local router ID is 3.3.3.3
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 100.0.1.0/24     10.1.13.1                0    111      0 100 i

这时R3的LOCAL_PRE为111

R4#show ip bgp
BGP table version is 11, local router ID is 4.4.4.4
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*>i100.0.1.0/24     10.1.13.1                0    111      0 100 i

R3给R4,R4也是111

R5#show ip bgp
BGP table version is 9, local router ID is 5.5.5.5
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 100.0.1.0/24     10.1.13.1                0    111      0 (64512) 100 i

R4给R5,R5也依旧是111

R2#show ip bgp
BGP table version is 6, local router ID is 2.2.2.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 100.0.1.0/24     10.1.25.5                              0 345 100 i

但是R5更新给R2时,则为空。

18.5.3.2.6 试验4:AS_PATH

传统的AS_PATH有4中类型,压AS间的。

联邦间AS传递,已新类型3.4压入。但是一旦出联邦AS号,则不可见。

R3#show ip bgp
BGP table version is 9, local router ID is 3.3.3.3
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 100.0.1.0/24     10.1.13.1                0    111      0 100 i

R3的路由为100

R4#show ip bgp
BGP table version is 11, local router ID is 4.4.4.4
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*>i100.0.1.0/24     10.1.13.1                0    111      0 100 i

传给R4依旧为100,没有出联邦内AS

R5#show ip bgp
BGP table version is 9, local router ID is 5.5.5.5
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 100.0.1.0/24     10.1.13.1                0    111      0 (64512) 100 i

R5则是(64512) 100,在联邦内部AS间传递,加入类型3.4的AS_PATH。

R5#show ip bgp 100.0.1.0
BGP routing table entry for 100.0.1.0/24, version 9
Paths: (1 available, best #1, table Default-IP-Routing-Table)
  Advertised to update-groups:
     2
  (64512) 100
    10.1.13.1 (metric 192) from 4.4.4.4 (4.4.4.4)
      Origin IGP, metric 0, localpref 111, valid, confed-external, best

标记:confed-external,

R2#show ip bgp
BGP table version is 6, local router ID is 2.2.2.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 100.0.1.0/24     10.1.25.5                              0 345 100 i

再传到R2,就看不到联邦内部AS号了,只有传统AS号。

18.5.4 联邦和反射器

发表回复