bgp deterministic-med
bgp deterministic-med(commands one)
bgp always-compare-med(commands two)
测试版本IOS Version 12.4(13b)
配置
预配置R1与R2之间为12.0.0.0/24,以此类推,R5上lo0:5.5.5.5.
R1的配置 router bgp 1 no synchronization bgp router-id 1.1.1.1 bgp log-neighbor-changes neighbor 12.0.0.2 remote-as 2 neighbor 13.0.0.3 remote-as 2 neighbor 14.0.0.4 remote-as 3 no auto-summary |
R2的配置 router bgp 2 no synchronization bgp router-id 2.2.2.2 bgp log-neighbor-changes neighbor 12.0.0.1 remote-as 1 neighbor 12.0.0.1 route-map xx out neighbor 25.0.0.5 remote-as 4 no auto-summary |
R3的配置 router bgp 2 no synchronization bgp router-id 3.3.3.3 bgp log-neighbor-changes neighbor 13.0.0.1 remote-as 1 neighbor 13.0.0.1 route-map xx out neighbor 35.0.0.5 remote-as 4 no auto-summary |
R4的配置 router bgp 3 no synchronization bgp router-id 4.4.4.4 bgp log-neighbor-changes neighbor 14.0.0.1 remote-as 1 neighbor 14.0.0.1 route-map xx out neighbor 45.0.0.5 remote-as 4 no auto-summary |
R5的配置 router bgp 3 no synchronization bgp router-id 4.4.4.4 bgp log-neighbor-changes neighbor 14.0.0.1 remote-as 1 neighbor 14.0.0.1 route-map xx out neighbor 45.0.0.5 remote-as 4 no auto-summary |
以上两命令有4种(官方)使用方式
1:两个命令都不用
2:只使用命令一
3:只使用命令二
4:使用命令一和命令二
解释:
1.两个命令都不用
R1#sh ip b 5.5.5.5 BGP routing table entry for 5.5.5.5/32, version 24 Paths: (3 available, best #3, table Default-IP-Routing-Table) Advertised to update-groups: 1 2 4 12.0.0.2 from 12.0.0.2 (2.2.2.2) Origin IGP, metric 120, localpref 100, valid, external 3 4 14.0.0.4 from 14.0.0.4 (4.4.4.4) Origin IGP, metric 100, localpref 100, valid, external 2 4 13.0.0.3 from 13.0.0.3 (3.3.3.3) Origin IGP, metric 110, localpref 100, valid, external, best 默认情况下,不比较MED,因为默认情况下来自不同AS的目标metric为空,由于使用route-map让其有了metric属性,这时情况分为以下2种 1.相同AS之间,比较metric,比如将R1与R4 断掉,无论你的刷新R3bgp的进程多少次,来自R3的目标前缀永远为best
2.不同AS之间(AS长度相同),使用bgp的路由决策一共11条。 上例有2个不同的AS组AS(path)2 4 and AS(path)3 4. |
2.只使用命令一
router bgp 1 no synchronization bgp router-id 1.1.1.1 bgp log-neighbor-changes bgp deterministic-med neighbor 12.0.0.2 remote-as 2 neighbor 13.0.0.3 remote-as 2 neighbor 14.0.0.4 remote-as 3 no auto-summary
|
3.只使用命令二
无论如何都会选择出metric最小的
|
4.两个都用
在AS(path)2 4中选择出entry1再会在AS(path)3 4选择出entry3之后,再一次比较entry1与entry2的metric(因为bgp always-compare-med开启),小的为best |
5.最后备注
在只使用命令二和两个使用都使用时(小3和小4节)的结果都一样,最终都会选择出metric最小的,但是bgp会做出不同的决策过程
转载于:https://blog.51cto.com/starshomes/1250818