依次选择从EBGP、联盟、IBGP学来的路由
配置修改下,R2R4 AS65002 R3 65003
[R1]dis cu conf bgp
#
bgp 100
 network 1.1.1.1 255.255.255.255
 undo synchronization
 peer 12.12.12.2 as-number 200
 peer 13.13.13.3 as-number 200
#
Return
[R2-bgp]dis th
#
bgp 65002 
 confederation id 200 
 confederation peer-as 65003
 network 2.2.2.2 255.255.255.255 
 undo synchronization
 peer 12.12.12.1 as-number 100 
 peer 4.4.4.4 as-number 65002 
 peer 4.4.4.4 next-hop-local 
 peer 4.4.4.4 connect-interface LoopBack0
#
Return
[R3-bgp]dis th
#
bgp 65003 
 confederation id 200 
 confederation peer-as 65002
 network 3.3.3.3 255.255.255.255 
 undo synchronization
 peer 4.4.4.4 as-number 65002 
 peer 13.13.13.1 as-number 100 
 peer 4.4.4.4 next-hop-local 
 peer 4.4.4.4 connect-interface LoopBack0
#
Return
[R4]dis cu conf bgp
#
bgp 65002
 confederation id 200
 confederation peer-as 65003
 network 4.4.4.4 255.255.255.255
 undo synchronization
 peer 2.2.2.2 as-number 65002
 peer 3.3.3.3 as-number 65003
 peer 2.2.2.2 connect-interface LoopBack0
 peer 3.3.3.3 connect-interface LoopBack0
#
Return
查看r2r4bgp路由表
[R4]dis bgp routing-table 
 Total Number of Routes: 5
 BGP Local router ID is 4.4.4.4 
 Status codes: * - valid, > - best, d - damped,
               h - history,  i - internal, s - suppressed, S - Stale
               Origin : i - IGP, e - EGP, ? - incomplete
     Network            NextHop         MED        LocPrf     PrefVal Path/Ogn
 *>i 1.1.1.1/32         3.3.3.3         0          100        0       (65003)
                                                                      100i
 * i                    2.2.2.2         0          100        0       100i
   i 2.2.2.2/32         2.2.2.2         0          100        0       i
   i 3.3.3.3/32         3.3.3.3         0          100        0       (65003)i
 *>  4.4.4.4/32         0.0.0.0         0                     0       i
[R2-bgp]dis bgp routing-table 
 Total Number of Routes: 4
 BGP Local router ID is 2.2.2.2 
 Status codes: * - valid, > - best, d - damped,
               h - history,  i - internal, s - suppressed, S - Stale
               Origin : i - IGP, e - EGP, ? - incomplete
     Network            NextHop         MED        LocPrf     PrefVal Path/Ogn
 *>  1.1.1.1/32         12.12.12.1      0                     0       100i
 * i                    3.3.3.3         0          100        0       (65003)
                                                                      100i
 *>  2.2.2.2/32         0.0.0.0         0                     0       i
   i 4.4.4.4/32         4.4.4.4         0          100        0       i
上述现象可知ebgp>联盟>ibgp
优选CLUSTER_LIST长度最短的路由;
优选ORIGINATOR_ID最小的路由;这两条原则我本想还用原来的拓扑来演示,可是遗憾没找到解决方法,重新画了一个,大家将就看

R2R3R4做反射
基本配置:
[R1-bgp]dis th
#
bgp 100 
 router-id 1.1.1.1 
 dampening
 network 1.1.1.1 255.255.255.255 
 import-route direct
 undo synchronization
 peer 12.12.12.2 as-number 100 
 peer 13.13.13.3 as-number 100 
#
Return
[R2-bgp]dis th
#
bgp 100 
 router-id 2.2.2.2 
 network 2.2.2.2 255.255.255.255 
 import-route direct
 undo synchronization
 peer 12.12.12.1 as-number 100 
 peer 24.24.24.4 as-number 100 
 peer 12.12.12.1 reflect-client
#
[R3-bgp]dis th
#
bgp 100 
 router-id 3.3.3.3 
 network 3.3.3.3 255.255.255.255 
 import-route direct
 undo synchronization
 peer 13.13.13.1 as-number 100 
 peer 35.35.35.5 as-number 100 
 peer 13.13.13.1 reflect-client
#
Return
[R4-bgp]dis th
#
bgp 100 
 router-id 4.4.4.4 
 network 4.4.4.4 255.255.255.255 
 import-route direct
 undo synchronization
 peer 24.24.24.2 as-number 100 
 peer 45.45.45.5 as-number 100 
 peer 24.24.24.2 reflect-client
#
Return
[R5-bgp]dis th
#
bgp 100 
 router-id 5.5.5.5 
 network 5.5.5.5 255.255.255.255 
 import-route direct
 undo synchronization
 peer 45.45.45.4 as-number 100 
 peer 35.35.35.3 as-number 100 
#
Return
查看R1bgp路由表
*>i 5.5.5.5/32         35.35.35.5      0          100        0       i
 * i                    45.45.45.5      0          100        0       i
为什么优选35.35.35.5的路由呢?
[R1-bgp]dis bgp routing-table 5.5.5.5
 BGP local router ID : 1.1.1.1
 Local AS number : 100
 Paths:   2 available, 1 best
 BGP routing table entry information of 5.5.5.5/32:
 From            : 13.13.13.3 (3.3.3.3)
 Relay Nexthop   : 13.13.13.3
 Original nexthop: 35.35.35.5
 AS-path         : (null)
 Origin          : igp
 Attribute value : MED 0, localpref 100, pref-val 0, pre 255
 State           : valid, internal, best,
 Originator      : 5.5.5.5
 Cluster list    : 3.3.3.3
 Not advertised to any peers yet
 BGP routing table entry information of 5.5.5.5/32:
 From            : 12.12.12.2 (2.2.2.2)
 Relay Nexthop   : 12.12.12.2
 Original nexthop: 45.45.45.5
 AS-path         : (null)
 Origin          : igp
 Attribute value : MED 0, localpref 100, pref-val 0, pre 255
 State           : valid, internal,
 Originator      : 5.5.5.5
 Cluster list    : 2.2.2.2, 4.4.4.4
 Not advertised to any peers yet
因为 来自R3的路由5.5.5.5Cluster list值比较短!
下面是优选ORIGINATOR_ID最小的路由
去掉R4上的反射配置!
查看R145.45.45.0bgp路由表
*>i 45.45.45.0/24      24.24.24.4      0          100        0       ?
 * i                    35.35.35.5      0          100        0       ?
[R1-bgp]dis bgp routing-table 45.45.45.0
 BGP local router ID : 1.1.1.1
 Local AS number : 100
 Paths:   2 available, 1 best
 BGP routing table entry information of 45.45.45.0/24:
 From            : 12.12.12.2 (2.2.2.2)
 Relay Nexthop   : 12.12.12.2
 Original nexthop: 24.24.24.4
 AS-path         : (null)
 Origin          : incomplete
 Attribute value : MED 0, localpref 100, pref-val 0, pre 255
 State           : valid, internal, best,
 Originator      : 4.4.4.4
 Cluster list    : 2.2.2.2
 Not advertised to any peers yet
 BGP routing table entry information of 45.45.45.0/24:
 From            : 13.13.13.3 (3.3.3.3)
 Relay Nexthop   : 13.13.13.3
 Original nexthop: 35.35.35.5
 AS-path         : (null)
 Origin          : incomplete
 Attribute value : MED 0, localpref 100, pref-val 0, pre 255
 State           : valid, internal,
 Originator      : 5.5.5.5
 Cluster list    : 3.3.3.3
 Not advertised to any peers yet
ORIGINATOR_ID这个值默认选router id