我们知道BGP路由默认会自动学习最优路由,无法等价的,那么我们通过BGP等价路由条目可以实现BGP等价路由的效果。
一 网络拓扑
如上图:
Leaf1和Spine1和Spine2建立IBGP,Border1和Spine1和Spine2建立EBGP;
二 设备配置
2.1 BGP等价路由配置命令
配置命令:
Leaf1(config)#rou bgp 100
Leaf1(config-router)#address-family ipv4
Leaf1(config-router-af)#maximum-paths ?
ebgp EBGP-multipath
ibgp IBGP-multipath
Leaf1(config-router-af)#
Leaf1(config-router-af)#maximum-paths ibgp ?
<1-32> Number of paths
Leaf1(config-router-af)#maximum-paths ibgp 32
Leaf1(config-router-af)#maximum-paths ebgp 32
Leaf1(config-router-af)#
2.2 Leaf1配置bgp等价路由
!
router bgp 100
bgp router-id 6.6.6.1
bgp log-neighbor-changes
bgp graceful-restart restart-time 120
bgp graceful-restart stalepath-time 360
bgp graceful-restart
neighbor 6.6.6.2 remote-as 100
neighbor 6.6.6.2 update-source Loopback 0
neighbor 6.6.6.3 remote-as 100
neighbor 6.6.6.3 update-source Loopback 0
address-family ipv4
maximum-paths ebgp 32
maximum-paths ibgp 32
network 6.6.6.6 mask 255.255.255.255
neighbor 6.6.6.2 activate
neighbor 6.6.6.3 activate
exit-address-family
!
2.3 Spine1、Spine2、Border同样配置
!
router bgp 100
address-family ipv4
maximum-paths ebgp 32
maximum-paths ibgp 32
!
三 状态查看
3.1 配置等价路由前BGP路由查看-非等价路由
Leaf1#sh bgp ipv4 unicast
BGP table version is 3, local router ID is 6.6.6.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
S Stale, b - backup entry, m - multipath, f Filter, a additional-path
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*bi 6.6.6.4/32 6.6.6.3 0 100 0 200 i备份
*>i 6.6.6.2 0 100 0 200 i
*> 6.6.6.6/32 0.0.0.0 0 32768 i
Total number of prefixes 2
Leaf1#
Leaf1#sh ip route
Codes: C - Connected, L - Local, S - Static
R - RIP, O - OSPF, B - BGP, I - IS-IS, V - Overflow route
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
SU - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
IA - Inter area, EV - BGP EVPN, A - Arp to host
LA - Local aggregate route
* - candidate default
Gateway of last resort is no set
C 1.1.1.0/31 is directly connected, GigabitEthernet 0/0
C 1.1.1.0/32 is local host.
C 1.1.1.2/31 is directly connected, GigabitEthernet 0/1
C 1.1.1.2/32 is local host.
C 6.6.6.1/32 is local host.
O 6.6.6.2/32 [110/1] via 1.1.1.1, 00:20:52, GigabitEthernet 0/0
O 6.6.6.3/32 [110/1] via 1.1.1.3, 00:17:36, GigabitEthernet 0/1
B 6.6.6.4/32 [200/0] via 6.6.6.2, 00:01:52
C 6.6.6.6/32 is local host.
Leaf1#
Leaf1#sh bgp ipv4 unicast 6.6.6.4
BGP routing table entry for 6.6.6.4/32(#0x7f9714becdd0)
Paths: (2 available, best #2, table Default-IP-Routing-Table)
Not advertised to any peer
200
6.6.6.3 (metric 1) from 6.6.6.3 (6.6.6.3)
Origin IGP, metric 0, localpref 100, valid, internal,backup备份路由
Last update: Mon Jun 22 23:23:08 2026
RX ID: 0,TX ID: 0
200
6.6.6.2 (metric 1) from 6.6.6.2 (6.6.6.2)
Origin IGP, metric 0, localpref 100, valid, internal, best
Last update: Mon Jun 22 23:22:36 2026
RX ID: 0,TX ID: 0
Leaf1#
3.2 配置等价路由前BGP路由查看-等价路由
Leaf1#sh bgp ipv4 unicast
BGP table version is 3, local router ID is 6.6.6.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
S Stale, b - backup entry, m - multipath, f Filter, a additional-path
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*mi 6.6.6.4/32 6.6.6.3 0 100 0 200 i
*>i 6.6.6.2 0 100 0 200 i
*> 6.6.6.6/32 0.0.0.0 0 32768 i
Total number of prefixes 2
Leaf1#sh ip route
Codes: C - Connected, L - Local, S - Static
R - RIP, O - OSPF, B - BGP, I - IS-IS, V - Overflow route
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
SU - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
IA - Inter area, EV - BGP EVPN, A - Arp to host
LA - Local aggregate route
* - candidate default
Gateway of last resort is no set
C 1.1.1.0/31 is directly connected, GigabitEthernet 0/0
C 1.1.1.0/32 is local host.
C 1.1.1.2/31 is directly connected, GigabitEthernet 0/1
C 1.1.1.2/32 is local host.
C 6.6.6.1/32 is local host.
O 6.6.6.2/32 [110/1] via 1.1.1.1, 00:30:56, GigabitEthernet 0/0
O 6.6.6.3/32 [110/1] via 1.1.1.3, 00:27:40, GigabitEthernet 0/1
B 6.6.6.4/32 [200/0] via 6.6.6.2, 00:02:59
[200/0] via 6.6.6.3, 00:02:59
C 6.6.6.6/32 is local host.
Leaf1#
Leaf1#
Leaf1#sh bgp ipv4 unicast 6.6.6.4
BGP routing table entry for 6.6.6.4/32(#0x7f9714becdd0)
Paths: (2 available, best #2, table Default-IP-Routing-Table)
Not advertised to any peer
200
6.6.6.3 (metric 1) from 6.6.6.3 (6.6.6.3)
Origin IGP, metric 0, localpref 100, valid, internal,multipath
Last update: Mon Jun 22 23:23:08 2026
RX ID: 0,TX ID: 0
200
6.6.6.2 (metric 1) from 6.6.6.2 (6.6.6.2)
Origin IGP, metric 0, localpref 100, valid, internal, multipath,best
Last update: Mon Jun 22 23:22:36 2026
RX ID: 0,TX ID: 0
Leaf1#