本帖最后由 碧云天 于 2020-3-24 21:35 编辑 一.测试拓扑测试总结:
- 设置weight只能在邻居的入方式设置
- local-preference修改可以向IBGP邻居传递
- 修改as-path属性只对EBGP邻居有效,对IBGP邻居无效
- 在入口方向和出口方向修改AS-PATH,增加AS的顺序不一样
- MED可以用于让对方选路
- 精确选路优先使用local-preference和MED属性,最不建议使用AS-path属性
二.基本配置
1.R5路由器hostname R5
interface Loopback0
ip address 5.5.5.5 255.255.255.0
interface Ethernet0/0
ip address 35.1.1.5 255.255.255.0
no shutdown
router bgp 65005
bgp router-id 5.5.5.5
neighbor 35.1.1.3 remote-as 65003
2.R3路由器hostname R3
interface Loopback0
ip address 3.3.3.3 255.255.255.0
interface Ethernet0/0
ip address 23.1.1.3 255.255.255.0
no shutdown
interface Ethernet0/1
ip address 13.1.1.3 255.255.255.0
no shutdown
interface Ethernet0/2
ip address 35.1.1.3 255.255.255.0
no shutdown
router bgp 65003
bgp router-id 3.3.3.3
neighbor 13.1.1.1 remote-as 65004
neighbor 23.1.1.2 remote-as 65004
neighbor 35.1.1.5 remote-as 65005
network 3.3.3.0 mask 255.255.255.0
3.R1路由器hostname R1
interface Loopback0
ip address 1.1.1.1 255.255.255.0
interface Ethernet0/1
ip address 13.1.1.1 255.255.255.0
no shutdown
interface Serial1/0
ip address 14.1.1.1 255.255.255.0
no shutdown
router ospf 1
router-id 1.1.1.1
passive-interface Loopback0
network 1.1.1.1 0.0.0.0 area 0
network 14.1.1.1 0.0.0.0 area 0
router bgp 65004
bgp router-id 1.1.1.1
neighbor 4.4.4.4 remote-as 65004
neighbor 4.4.4.4 update-source Loopback0
neighbor 4.4.4.4 next-hop-self
neighbor 13.1.1.3 remote-as 65003
4.R2路由器hostname R2
interface Loopback0
ip address 2.2.2.2 255.255.255.0
ip ospf network point-to-point
interface Ethernet0/0
ip address 23.1.1.2 255.255.255.0
no shutdown
interface Ethernet0/1
ip address 24.1.1.2 255.255.255.0
ip ospf network point-to-point
no shutdown
router ospf 1
router-id 2.2.2.2
passive-interface Loopback0
network 2.2.2.2 0.0.0.0 area 0
network 24.1.1.2 0.0.0.0 area 0
router bgp 65004
bgp router-id 2.2.2.2
neighbor 4.4.4.4 remote-as 65004
neighbor 4.4.4.4 update-source Loopback0
neighbor 4.4.4.4 next-hop-self
neighbor 23.1.1.3 remote-as 65003
5.R4路由器hostname R4
interface Loopback0
ip address 4.4.4.4 255.255.255.0
ip ospf network point-to-point
interface Ethernet0/1
ip address 24.1.1.4 255.255.255.0
ip ospf network point-to-point
no shutdown
interface Serial1/0
ip address 14.1.1.4 255.255.255.0
no shutdown
router ospf 1
router-id 4.4.4.4
passive-interface Loopback0
network 4.4.4.4 0.0.0.0 area 0
network 14.1.1.4 0.0.0.0 area 0
network 24.1.1.4 0.0.0.0 area 0
router bgp 65004
bgp router-id 4.4.4.4
neighbor 1.1.1.1 remote-as 65004
neighbor 1.1.1.1 update-source Loopback0
neighbor 1.1.1.1 next-hop-self
neighbor 2.2.2.2 remote-as 65004
neighbor 2.2.2.2 update-source Loopback0
network 4.4.4.0 mask 255.255.255.0
neighbor 2.2.2.2 next-hop-self
network 4.4.4.0 mask 255.255.255.0
三.BGP选路属性测试
1.weight属性测试
①配置之前查看R4上面的选路R4#show ip bgp | begin Network
Network Next Hop Metric LocPrf Weight Path
* i 3.3.3.0/24 1.1.1.1 0 100 0 65003 i
*>i 2.2.2.2 0 100 0 65003 i
*> 4.4.4.0/24 0.0.0.0 0 32768 i
R4#
②weight不能在out方向上设置A.R1上配置route-mapaccess-list 3 permit 3.3.3.0
route-map SetWeight permit 10
match ip address 3
set weight 1
route-map SetWeight permit 20
B.R1在out方向应用route-map会报错R1(config-route-map)#router bgp 65004
R1(config-router)#neighbor 4.4.4.4 route-map SetWeight out
% "SetWeight" used as BGP outbound route-map, set weight not supported
R1(config-router)#
③在R4针对R1邻居的in方向设置weightA.R4上配置route-mapaccess-list 3 permit 3.3.3.0
route-map SetWeight permit 10
match ip address 3
set weight 1
route-map SetWeight permit 20
B.R4针对R1邻居的in方向应用route-map,可以看到R4的选路已经修改router bgp 65004
neighbor 1.1.1.1 route-map SetWeight in
do clear ip bgp * soft
R4(config-router)#do clear ip bgp * soft
R4(config-router)#do show ip bgp | begin Network
Network Next Hop Metric LocPrf Weight Path
*>i 3.3.3.0/24 1.1.1.1 0 100 1 65003 i
* i 2.2.2.2 0 100 0 65003 i
*> 4.4.4.0/24 0.0.0.0 0 32768 i
2.local-preference属性测试
①在R4上针对R2邻居in方向修改local-preferenceA.R4上配置route-mapaccess-list 3 permit 3.3.3.0
route-map SetLocPrf permit 10
match ip address 3
set local-preference 101
route-map SetLocPrf permit 20
B.R4针对R2邻居的in方向应用route-maprouter bgp 65004
neighbor 2.2.2.2 route-map SetLocPrf in
C.软清R2R2#clear ip bgp * soft
D.可以看到R4上的local-preference已经修改,但是选路没有修改R4(config-router)#do show ip bgp | begin Network
Network Next Hop Metric LocPrf Weight Path
*>i 3.3.3.0/24 1.1.1.1 0 100 1 65003 i
* i 2.2.2.2 0 101 0 65003 i
*> 4.4.4.0/24 0.0.0.0 0 32768 i
E.R4上清除针对R1邻居的weight设置router bgp 65004
no neighbor 1.1.1.1 route-map SetWeight in
do clear ip bgp * soft
F.软清R1R1#clear ip bgp * soft
G.可以看到,R4的选路已经修改,因此可以确定weight优先级大于local-preferenceR4(config-router)#do show ip bgp | begin Network
Network Next Hop Metric LocPrf Weight Path
* i 3.3.3.0/24 1.1.1.1 0 100 0 65003 i
*>i 2.2.2.2 0 101 0 65003 i
*> 4.4.4.0/24 0.0.0.0 0 32768 i
②local-preference也可以在邻居out方向修改A.R1上配置route-mapaccess-list 3 permit 3.3.3.0
route-map SetLocPrf permit 10
match ip address 3
set local-preference 102
route-map SetLocPrf permit 20
B.R1针对R4邻居的out方向应用route-maprouter bgp 65004
neighbor 4.4.4.4 route-map SetLocPrf out
C.R1软清R1(config-router)#do clear ip bgp * soft
D.可以看到R4的选路已经修改R4(config-router)#do show ip bgp | begin Network
Network Next Hop Metric LocPrf Weight Path
*>i 3.3.3.0/24 1.1.1.1 0 102 0 65003 i
* i 2.2.2.2 0 101 0 65003 i
*> 4.4.4.0/24 0.0.0.0 0 32768 i
③local-preference可以向IBGP邻居传递A.清除R4上配置router bgp 65004
neighbor 2.2.2.2 route-map SetLocPrf in
do clear ip bgp * soft
B.清除R1上配置router bgp 65004
no neighbor 4.4.4.4 route-map SetLocPrf out
do clear ip bgp * soft
C.R1配置route-mapaccess-list 3 permit 3.3.3.0
route-map SetLocPrf permit 10
match ip address 3
set local-preference 103
route-map SetLocPrf permit 20
D.R1针对EBGP邻居R3的in方向应用route-map,设置local-preferencerouter bgp 65004
neighbor 13.1.1.3 route-map SetLocPrf in
do clear ip bgp * soft
E.可以看到不仅R1上修改了local-preference,并且传递给了IBGP邻居R4R1(config-router)#do show ip bgp | begin Network
Network Next Hop Metric LocPrf Weight Path
*> 3.3.3.0/24 13.1.1.3 0 103 0 65003 i
r>i 4.4.4.0/24 4.4.4.4 0 100 0 i
R1(config-router)#
R4(config-router)#do show ip bgp | begin Network
Network Next Hop Metric LocPrf Weight Path
*>i 3.3.3.0/24 1.1.1.1 0 103 0 65003 i
* i 2.2.2.2 0 100 0 65003 i
*> 4.4.4.0/24 0.0.0.0 0 32768 i
R4(config-router)#
3.AS-Path属性测试
①先查看R5上AS-path显示的顺序以及R3上的选路R5#show ip bgp | begin Network
Network Next Hop Metric LocPrf Weight Path
*> 3.3.3.0/24 35.1.1.3 0 0 65003 i
*> 4.4.4.0/24 35.1.1.3 0 65003 65004 i
R5#
R4#show ip bgp | begin Network
Network Next Hop Metric LocPrf Weight Path
*>i 3.3.3.0/24 1.1.1.1 0 103 0 65003 i
* i 2.2.2.2 0 100 0 65003 i
*> 4.4.4.0/24 0.0.0.0 0 32768 i
R4#
备注:可以看到,去往路由的AS-path路径从左到右是先近后远的。②在IBGP邻居设置AS-path无效A. 在R1的IBGP的入口方式设置route-map增加ASaccess-list 4 permit 4.4.4.0
route-map SetASpath permit 10
match ip address 4
set as-path prepend 1 2 3 4
route-map SetASpath permit 20
router bgp 65004
neighbor 4.4.4.4 route-map SetASpath in
do clear ip bgp * soft
R4#clear ip bgp * soft
R1#show ip bgp | begin Network
Network Next Hop Metric LocPrf Weight Path
*> 3.3.3.0/24 13.1.1.3 0 103 0 65003 i
r>i 4.4.4.0/24 4.4.4.4 0 100 0 i
R1#
B.在R4的IBGP的出口方式设置route-map增加ASaccess-list 4 permit 4.4.4.0
route-map SetASpath permit 10
match ip address 4
set as-path prepend 1 2 3 4
route-map SetASpath permit 20
router bgp 65004
neighbor 1.1.1.1 route-map SetASpath out
do clear ip bgp * soft
R1#clear ip bgp * soft
R1#show ip bgp | begin Network
Network Next Hop Metric LocPrf Weight Path
*> 3.3.3.0/24 13.1.1.3 0 103 0 65003 i
r>i 4.4.4.0/24 4.4.4.4 0 100 0 i
R1#
③可以在EBGP的出入口方向设置route-map增加ASA.在R3的EBGP的入口方式设置route-map增加ASaccess-list 4 permit 4.4.4.0
route-map SetASpath permit 10
match ip address 4
set as-path prepend 1 2 3 4
route-map SetASpath permit 20
router bgp 65003
neighbor 23.1.1.2 route-map SetASpath in
do clear ip bgp * soft
R3#show ip bgp | begin Network
Network Next Hop Metric LocPrf Weight Path
*> 3.3.3.0/24 0.0.0.0 0 32768 i
*> 4.4.4.0/24 13.1.1.1 0 65004 i
* 23.1.1.2 0 1 2 3 4 65004 i
R3#
备注:可以看到,如果在人口方式增加AS-PATH,会在左侧增加,即不改变原有的path,在已有path之后追加。
另外,为了防止路由被丢弃,实际情况如果增加AS,建议增加自己的AS的AS号,或者私有AS号B.在R2的EBGP的出口方式设置route-map增加AS--配置之前,清除R3的配置
router bgp 65003
no neighbor 23.1.1.2 route-map SetASpath in
do clear ip bgp * soft
--配置R2
access-list 4 permit 4.4.4.0
route-map SetASpath permit 10
match ip address 4
set as-path prepend 1 2 3 4
route-map SetASpath permit 20
router bgp 65004
neighbor 23.1.1.3 route-map SetASpath out
do clear ip bgp * soft
R3#show ip bgp | begin Network
Network Next Hop Metric LocPrf Weight Path
*> 3.3.3.0/24 0.0.0.0 0 32768 i
*> 4.4.4.0/24 13.1.1.1 0 65004 i
* 23.1.1.2 0 65004 1 2 3 4 i
R3#
备注:可以看到,如果在出口方式增加AS-PATH,会在右侧增加,即在已有path路径之前追加,并且R3选路已经做了修改,选择了AS-Path短的路径。④R3可以设置接收最多AS号的路由router bgp 65003
bgp maxas-limit 4
do clear ip bgp * soft
R3(config-router)#
*Mar 18 07:59:54.478: %BGP-6-MSGDUMP_LIMIT: unsupported or mal-formatted message received from 23.1.1.2:
FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF 003F 0200 0000 2440 0101 0040 0216 0205
0000 FDEC 0000 0001 0000 0002 0000 0003 0000 0004 4003 0417 0101 0218 0404 04
*Mar 18 07:59:54.478: %BGP-6-ASPATH: Long AS path 65004 1 2 3 4 received from 23.1.1.2: BGP(0) Prefixes: 4.4.4.0/24
R3(config-router)#do show ip bgp | begin Network
Network Next Hop Metric LocPrf Weight Path
*> 4.4.4.0/24 13.1.1.1 0 65004 i
R3(config-router)#
备注:可以看到,如果设置AS号最多为4个时,如果接收到包含4个AS号的路由的时候会丢弃,另外,如果在R3的入口方向增加AS-PATH,增加后的路径大于最大值没有影响。⑤EBGP默认如果收到的路由包含自己的AS号,则丢弃,不过可以修改(不建议)A.清除R2上配置router bgp 65004
no neighbor 23.1.1.3 route-map SetASpath out
do clear ip bgp * soft
B.清除R3上配置router bgp 65003
no bgp maxas-limit 4
do clear ip bgp * soft
C.在R2上配置access-list 4 permit 4.4.4.0
route-map SetASpath permit 10
match ip address 4
set as-path prepend 1 65003
route-map SetASpath permit 20
router bgp 65004
neighbor 23.1.1.3 route-map SetASpath out
do clear ip bgp * soft
D.查看效果R3#show ip bgp | begin Network
Network Next Hop Metric LocPrf Weight Path
*> 3.3.3.0/24 0.0.0.0 0 32768 i
*> 4.4.4.0/24 13.1.1.1 0 65004 i
R3#
备注:可以看到,R3丢弃了包含自己AS号的路由E.修改R3的配置router bgp 65003
neighbor 23.1.1.2 allowas-in
do clear ip bgp * soft
F.查看效果R3#show ip bgp | begin Network
Network Next Hop Metric LocPrf Weight Path
*> 3.3.3.0/24 0.0.0.0 0 32768 i
* 4.4.4.0/24 23.1.1.2 0 65004 1 65003 i
*> 13.1.1.1 0 65004 i
R3#
⑥此时如果在R3上设置R2邻居in方向的local-preference,可以修改R3上路由选择,说明local-preference优先级高于AS-pathA.R3上配置route-mapaccess-list 4 permit 4.4.4.0
route-map SetLocPrf permit 10
match ip address 4
set local-preference 101
route-map SetLocPrf permit 20
B.R3针对R2邻居in方向应用route-map,增加local-preferencerouter bgp 65003
neighbor 23.1.1.2 route-map SetLocPrf in
do clear ip bgp * soft
C.R2进行软清R2(config-router)#do clear ip bgp * soft
D.可以看到R3上路径已经改变,选择了AS-path长,但local-preference大的路径R3#show ip bgp | be
R3#show ip bgp | begin Network
Network Next Hop Metric LocPrf Weight Path
*> 3.3.3.0/24 0.0.0.0 0 32768 i
*> 4.4.4.0/24 23.1.1.2 101 0 65004 1 65003 i
* 13.1.1.1 0 65004 i
R3#
⑦让路由器不比较as-pathbgp bestpath as-path ignore (为隐藏命令,问号不会显示)
4.Origin属性测试
①清除之前的配置,让R3恢复默认选路R3#show ip bgp | begin Network
Network Next Hop Metric LocPrf Weight Path
*> 3.3.3.0/24 0.0.0.0 0 32768 i
* 4.4.4.0/24 13.1.1.1 0 65004 i
*> 23.1.1.2 0 65004 i
R3#
②R4上针对邻居R2的out方向设置起源属性为incompleteA.R4上配置access-list 4 permit 4.4.4.0
route-map SetOrigin permit 10
match ip address 4
set origin incomplete
route-map SetOrigin permit 20
router bgp 65004
neighbor 2.2.2.2 route-map SetOrigin out
do clear ip bgp * soft
B.查看R3的选路,已经做了修改R3#show ip bgp | begin Network
Network Next Hop Metric LocPrf Weight Path
*> 3.3.3.0/24 0.0.0.0 0 32768 i
*> 4.4.4.0/24 13.1.1.1 0 65004 i
* 23.1.1.2 0 65004 ?
R3#
③R1上针对邻居R3设置AS-path属性,增加ASA.R1上配置access-list 4 permit 4.4.4.0
route-map SetAsPath permit 10
match ip address 4
set as-path prepend 65004
route-map SetAsPath permit 20
router bgp 65004
neighbor 13.1.1.3 route-map SetAsPath out
do clear ip bgp * soft
B.查看R3的选路,已经做了修改R3#show ip bgp | begin Network
Network Next Hop Metric LocPrf Weight Path
*> 3.3.3.0/24 0.0.0.0 0 32768 i
* 4.4.4.0/24 13.1.1.1 0 65004 65004 i
*> 23.1.1.2 0 65004 ?
R3#
备注:可以看出,AS-path的优先级要大于起源属性。5.Med属性测试
①清除之前的配置,查看R3针对4.4.4.0的选路,走R1R3#show ip bgp | begin Network
Network Next Hop Metric LocPrf Weight Path
*> 3.3.3.0/24 0.0.0.0 0 32768 i
* 4.4.4.0/24 23.1.1.2 0 65004 i
*> 13.1.1.1 0 65004 i
R3#
备注:清除配置,重置配置,这次却与之前的不一样,可能时模拟器的原因。②R1针对EBGP邻居R3配置route-map,增加MEDA.R1配置route-mapaccess-list 4 permit 4.4.4.0
route-map SetMED permit 10
match ip address 4
set metric 10
route-map SetMED permit 20
B.R1针对EBGP邻居R2应用route-maprouter bgp 65004
neighbor 13.1.1.3 route-map SetMED out
do clear ip bgp * soft
C.查看R3的选路已经做了修改,现在4.4.4.0下一跳走R2R3#show ip bgp | begin Network
Network Next Hop Metric LocPrf Weight Path
*> 3.3.3.0/24 0.0.0.0 0 32768 i
*> 4.4.4.0/24 23.1.1.2 0 65004 i
* 13.1.1.1 10 0 65004 i
R3#
D.在R5上面查看,可以看出metric不会传递下一个ASR5#show ip bgp | begin Network
Network Next Hop Metric LocPrf Weight Path
*> 3.3.3.0/24 35.1.1.3 0 0 65003 i
*> 4.4.4.0/24 35.1.1.3 0 65003 65004 i
R5#
E.在R2上针对邻居R3设置route-map,增加ASaccess-list 4 permit 4.4.4.0
route-map SetASpath permit 10
match ip address 4
set as-path prepend 65004
route-map SetASpath permit 20
router bgp 65004
neighbor 23.1.1.3 route-map SetASpath out
do clear ip bgp * soft
F.可以看到R3针对4.4.4.0下一跳已经修改,走R1,说明AS-path优先级大于MEDR3#show ip bgp | BEgin Network
Network Next Hop Metric LocPrf Weight Path
*> 3.3.3.0/24 0.0.0.0 0 32768 i
* 4.4.4.0/24 23.1.1.2 0 65004 65004 i
*> 13.1.1.1 10 0 65004 i
R3#
③R3针对EBGP邻居R2配置route-map,增加MEDA.配置先查看R4上针对3.3.3.0的选路,走R2,因为带宽高R4#show ip bgp | Begin Network
Network Next Hop Metric LocPrf Weight Path
*>i 3.3.3.0/24 2.2.2.2 0 100 0 65003 i
* i 1.1.1.1 0 100 0 65003 i
*> 4.4.4.0/24 0.0.0.0 0 32768 i
R4#
B.R3针对EBGP邻居R2配置route-map,增加MEDaccess-list 3 permit 3.3.3.0
route-map SetMED permit 10
match ip address 3
set metric 1
route-map SetMED permit 20
router bgp 65003
neighbor 23.1.1.2 route-map SetMED out
do clear ip bgp * soft
C.这时查看R4上针对3.3.3.0的下一跳已经修改,走R1,说明MED能在邻居的AS内部传递R4#show ip bgp | BEgin Network
Network Next Hop Metric LocPrf Weight Path
* i 3.3.3.0/24 2.2.2.2 1 100 0 65003 i
*>i 1.1.1.1 0 100 0 65003 i
*> 4.4.4.0/24 0.0.0.0 0 32768 i
R4#
④设置思科路由默认MED为最大值A.清除R1上增加med值的设置router BGP 65004
no neighbor 13.1.1.3 route-map SetMED out
do clear ip bgp * soft
B.R3上执行相应命令
router BGP 65004
bgp bestpath med missing-as-worst
do clear ip bgp * soft
B.可以看到,R3配置完成后,会把所有的接收EBGP路由的metric设置的非常大R3#show ip bgp | begin Network
Network Next Hop Metric LocPrf Weight Path
*> 3.3.3.0/24 0.0.0.0 0 32768 i
*> 4.4.4.0/24 13.1.1.1 4294967295 0 65004 i
* 23.1.1.2 4294967295 0 65004 65004 i
R3#
C.这时R5发布一条路由5.5.5.0/24,不知道为什么,R3不会针对此路由修改默认metric值R3#show ip bgp | begin Network
Network Next Hop Metric LocPrf Weight Path
*> 3.3.3.0/24 0.0.0.0 0 32768 i
*> 4.4.4.0/24 13.1.1.1 4294967295 0 65004 i
* 23.1.1.2 4294967295 0 65004 65004 i
*> 5.5.5.0/24 35.1.1.5 0 0 65005 i
R3#
D.R5上执行相同的命令,发现R5只是针对4.4.4.0的路由设置了meitric,针对3.3.3.0没有router BGP 65005
bgp bestpath med missing-as-worst
do clear ip bgp * soft
R5#show ip bgp | begin Network
Network Next Hop Metric LocPrf Weight Path
*> 3.3.3.0/24 35.1.1.3 0 0 65003 i
*> 4.4.4.0/24 35.1.1.3 4294967295 0 65003 65004 i
*> 5.5.5.0/24 0.0.0.0 0 32768 i
R5#
E.把所有路由器no router bgp ,再重新配置,并在所有路由器上面配置bgp bestpath med missing-as-worstR5#show ip bgp | begin Network
Network Next Hop Metric LocPrf Weight Path
*> 3.3.3.0/24 35.1.1.3 0 0 65003 i
*> 4.4.4.0/24 35.1.1.3 4294967295 0 65003 65004 i
*> 5.5.5.0/24 0.0.0.0 0 32768 i
R5#
R3#show ip bgp | begin Network
Network Next Hop Metric LocPrf Weight Path
*> 3.3.3.0/24 0.0.0.0 0 32768 i
* 4.4.4.0/24 13.1.1.1 4294967295 0 65004 i
*> 23.1.1.2 4294967295 0 65004 i
*> 5.5.5.0/24 35.1.1.5 0 0 65005 i
R3#
R1#show ip bgp | begin Network
Network Next Hop Metric LocPrf Weight Path
*> 3.3.3.0/24 13.1.1.3 0 0 65003 i
r>i 4.4.4.0/24 4.4.4.4 0 100 0 i
*> 5.5.5.0/24 13.1.1.3 4294967295 0 65003 65005 i
R1#
R2#show ip bgp | begin Network
Network Next Hop Metric LocPrf Weight Path
*> 3.3.3.0/24 23.1.1.3 0 0 65003 i
r>i 4.4.4.0/24 4.4.4.4 0 100 0 i
*> 5.5.5.0/24 23.1.1.3 4294967295 0 65003 65005 i
R2#
R4#show ip bgp | begin Network
Network Next Hop Metric LocPrf Weight Path
* i 3.3.3.0/24 1.1.1.1 0 100 0 65003 i
*>i 2.2.2.2 0 100 0 65003 i
*> 4.4.4.0/24 0.0.0.0 0 32768 i
* i 5.5.5.0/24 1.1.1.1 4294967295 100 0 65003 65005 i
*>i 2.2.2.2 4294967295 100 0 65003 65005 i
R4#
备注:从上面结果来看,bgp bestpath med missing-as-worst命令会把非EBGP邻居学习到的EBGP路由的metric设置一个很大的值
另外,R4因为没有EBGP邻居,配置和不配置相同,metric由IBGP邻居传递过来的。