拓扑

default-originate
- 在R2 上针对每个邻居宣告默认路由 : neighbor 10.12.1.1 default-originate. 然后在R1 和R3 上都可以学到


network 0.0.0.0
- 创建1条默认路由:ip route 0.0.0.0 0.0.0.0 null 0
- 在BGP 中通过 network 命令宣告
- 在R1 和 R3 上可以学到
default information originate + redistribute static
- 创建1条默认路由:ip route 0.0.0.0 0.0.0.0 null 0
- 在BGP 中 进入 address-family,执行 重分布 redistribute static 或者 default information originate,配合使用
- 在R1 和 R3 上可以学到
如何判断优先级
- 利用BGP Community 属性
- 严格来说,这里并不严谨。因为在BGP 里no 掉route-map,实际上把对应的 community 也no 掉了
router bgp 65200
neighbor 10.12.1.1 remote-as 65100
neighbor 10.23.1.2 remote-as 65200
!
address-family ipv4
default-information originate
neighbor 10.23.1.2 activate
neighbor 10.12.1.1 activate
neighbor 10.12.1.1 default-originate route-map RM_DEFAULT_111
neighbor 10.23.1.2 default-originate route-map RM_DEFAULT_111
network 0.0.0.0 route-map RM_DEFAULT_222
redistribute static route-map RM_DEFAULT_333
neighbor 10.12.1.1 send-community
neighbor 10.23.1.2 send-community
exit-address-family
ip prefix-list DEFAULT seq 5 permit 0.0.0.0/0
!
route-map RM_DEFAULT_111 permit 10
match ip address prefix-list DEFAULT
set community 111
!
route-map RM_DEFAULT_222 permit 10
match ip address prefix-list DEFAULT
set community 222
!
route-map RM_DEFAULT_333 permit 10
match ip address prefix-list DEFAULT
set community 333
- 在R1 和 R3 上确认路由明细,可以看到 Community 是 111

- 回到R2, no 掉 neighbor 10.12.1.1 default-originate route-map RM_DEFAULT_111 。再回R1,查看路由明细,Community 变为 222

- 回到R2,再 no 掉 network 。再回R1,查看路由明细,Community 变为333
