十一、补充知识

   1、解决IBGP的水平分割:
   (1)路由反射器:下图是C/S模型,R1是RR,是S
a.RR从EBGP收到的路由:即会反射给我的客户端,也会反射给我的非客户端
b,RR从client端收到的路由:会反射给我的client,以及我的非client,以及我的EBGP邻居        
c.RR从非client收到的路由:只会反射给client端和EBGP邻居,不会反射给非client
 
实验如图:默认R3是不会给R4发路由的,因为IBGP水平分割的,解决方法配置如下:
 
R3(config)#router bgp1
R3(config-router)#neighbor 1.1.1.1 route-reflector-client(这条命令即把R1变成客户端,也把自己变成server了,也就是RR了)
R3(config-router)#neighbor 4.4.4.4 route-reflector-client  
(2)联邦
Router bgp 小AS号(私有AS号)
声明所在的大AS号
小AS号之间互指peer
实验如上图,配置如下:
R1(config)#router bgp 64512
R1(config-router)#neighbor 12.1.1.2 remote-as 2
R1(config-router)#neighbor 3.3.3.3 remote-as 64512
         R1(config-router)#neighbor 3.3.3.3 update-source loopback 0
       R1(config-router)#neighbor 3.3.3.3 next-hop-self
 R3(config)#router bgp 64512
R3(config-router)#neighbor 1.1.1.1 remote-as 64512
 R3(config-router)#neighbor 1.1.1.1 update-source loopback 0
R3(config-router)#neighbor 4.4.4.4 remote-as 64513
         R3(config-router)#neighbor 4.4.4.4 update-source loopback 0
         R3(config-router)#neighbor 4.4.4.4 ebgp-multihop
 R4(config)#router bgp 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 3.3.3.3 ebgp-multihop
 
在联邦中的每台路由器上声明大AS号:
R1(config)#router bgp 64512
R1(config-router)#bgp confederation identifier 1(声明大AS号,联邦中的每台路由器都的做)
R3(config-router)#bgp confederation identifier 1
R4(config-router)#bgp confederation identifier 1
在小AS边界互指peer
R3(config-router)#bgp confederation peers 64513
R4(config-router)#bgp confederation peers 64512
3、 社团属性:Community:干涉路由传播范围
(1)       可选:路由器有可能不识别此属性(default),如果想识别,做如下配置:neighbor x.x.x.x send-community
(2)       传递:社团属性只在neighbor邻居有效,如果想往下传,做如下配置:neighbor x.x.x.x send-community
(3)       属性no-advertise:携带此社团属性的路由不会通告给任何BGP邻居
R2(config)#router-map COM
R2(config-router-map)#set community no-advertise
      R2(config)#router bgp 2
      R2(config-router)#neighbor 12.1.1.1 router-map COM out
               R2(config-router)#neighbor 12.1.1.1 send-community
        (4)属性no-export:携带此社团属性的路由不会传出大AS
R2(config)#router-map COM
R2(config-router-map)#set community no-export
      R2(config)#router bgp 2
      R2(config-router)#neighbor 12.1.1.1 router-map COM out
               R2(config-router)#neighbor 12.1.1.1 send-community
        (5)属性local-AS:携带此社团属性的路由不会传出小AS
R2(config)#router-map COM
R2(config-router-map)#set community local-AS
      R2(config)#router bgp 2
      R2(config-router)#neighbor 12.1.1.1 router-map COM out
               R2(config-router)#neighbor 12.1.1.1 send-community