我们知道BGP路由默认会自动学习最优路由,无法等价的,那么我们通过BGP等价路由条目可以实现BGP等价路由的效果。
一 网络拓扑
如上图:
Leaf1和Spine1和Spine2建立IBGP,Border1和Spine1和Spine2建立EBGP;
二 设备配置
2.1 BGP等价路由配置命令
配置命令:
[Leaf01]bgp 100
[Leaf01-bgp-default]
[Leaf01-bgp-default]address-family ipv4 unicast
[Leaf01-bgp-default-ipv4]balance ?
INTEGER<1-32> Number of BGP routes for load balancing
as-path-neglect Neglect the AS-PATH attribute when selecting load balancing
routes
as-path-relax Relax AS-PATH check when selecting load balancing routes
ebgp Configure load balancing for EBGP routes
eibgp Configure load balancing for both IBGP and EBGP routes, and
allow simultaneous use of IBGP and EBGP routes
ibgp Configure load balancing for IBGP routes
[Leaf01-bgp-default-ipv4]balance
[Leaf01-bgp-default-ipv4]balance eibgp ?
INTEGER<1-32> Number of BGP routes for load balancing
[Leaf01-bgp-default-ipv4]balance eibgp
注意:ibgp和ebgp,最新的配置会覆盖前面的配置,eibgp配置的时候ibgp、ebgp如果配置了,需要删除ibgp、ebgp的配置
2.2 Leaf1配置bgp等价路由
#
bgp 100
router-id 6.6.6.1
peer 6.6.6.2 as-number 100
peer 6.6.6.2 connect-interface LoopBack0
peer 6.6.6.3 as-number 100
peer 6.6.6.3 connect-interface LoopBack0
#
address-family ipv4 unicast
balance eibgp 32
network 6.6.6.6 255.255.255.255
peer 6.6.6.2 enable
peer 6.6.6.3 enable
#
2.3 Spine1、Spine2、Border同样配置
!
bgp 100
#
address-family ipv4 unicast
balance eibgp 32
!
三 状态查看
3.1 配置等价路由前BGP路由查看-非等价路由
<Leaf1>dis ip routing-table 6.6.6.4
Summary count : 1
Destination/Mask Proto Pre Cost NextHop Interface
6.6.6.4/32 BGP 255 0 6.6.6.2 GE0/0 //等价路由
<Leaf1>dis bgp routing-table ipv4
Total number of routes: 2
BGP local router ID is 6.6.6.1
Status codes: * - valid, > - best, d - dampened, h - history,
s - suppressed, S - stale, i - internal, e - external
Origin: i - IGP, e - EGP, ? - incomplete
Network NextHop MED LocPrf PrefVal Path/Ogn
* >i 6.6.6.4/32 6.6.6.2 0 100 0 200i//等价路由
* > 6.6.6.6/32 127.0.0.1 0 32768 i
<Leaf01>dis ip routing-table
Destinations : 15 Routes : 15
Destination/Mask Proto Pre Cost NextHop Interface
6.6.6.2/32 O_INTRA 10 1 1.1.1.1 GE0/0
6.6.6.3/32 O_INTRA 10 1 1.1.1.3 GE0/1
6.6.6.4/32 BGP 255 0 6.6.6.2 GE0/0
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
<Leaf01>
<Leaf01>dis bgp routing-table ipv4 6.6.6.4
BGP local router ID: 6.6.6.1
Local AS number: 100
Paths: 2 available, 1 best
BGP routing table information of 6.6.6.4/32:
From : 6.6.6.2 (6.6.6.2)
Rely nexthop : 1.1.1.1
Original nexthop: 6.6.6.2
OutLabel : NULL
AS-path : 200
Origin : igp
Attribute value : MED 0, localpref 100, pref-val 0
State : valid, internal, best
IP precedence : N/A
QoS local ID : N/A
Traffic index : N/A
VPN-Peer UserID : N/A
DSCP : N/A
EXP : N/A
Tunnel policy : NULL
Rely tunnel IDs : N/A
From : 6.6.6.3 (6.6.6.3)
Rely nexthop : 1.1.1.3
Original nexthop: 6.6.6.3
OutLabel : NULL
AS-path : 200
Origin : igp
Attribute value : MED 0, localpref 100, pref-val 0
State : valid, internal
IP precedence : N/A
QoS local ID : N/A
Traffic index : N/A
VPN-Peer UserID : N/A
DSCP : N/A
EXP : N/A
Tunnel policy : NULL
Rely tunnel IDs : N/A
<Leaf01>
3.2 配置等价路由前BGP路由查看-等价路由
<Leaf1>dis ip routing-table 6.6.6.4
Summary count : 2
Destination/Mask Proto Pre Cost NextHop Interface
6.6.6.4/32 BGP 255 0 6.6.6.2 GE0/0 //等价路由
BGP 255 0 6.6.6.3 GE0/1
<Leaf1>dis bgp routing-table ipv4
Total number of routes: 3
BGP local router ID is 6.6.6.1
Status codes: * - valid, > - best, d - dampened, h - history,
s - suppressed, S - stale, i - internal, e - external
Origin: i - IGP, e - EGP, ? - incomplete
Network NextHop MED LocPrf PrefVal Path/Ogn
* >i 6.6.6.4/32 6.6.6.2 0 100 0 200i//等价路由
* >i 6.6.6.3 0 100 0 200i
* > 6.6.6.6/32 127.0.0.1 0 32768 i
<Leaf1>dis ip routing-table
Destinations : 16 Routes : 17
Destination/Mask Proto Pre Cost NextHop Interface
0.0.0.0/32 Direct 0 0 127.0.0.1 InLoop0
1.1.1.0/31 Direct 0 0 1.1.1.0 GE0/0
1.1.1.0/32 Direct 0 0 127.0.0.1 InLoop0
1.1.1.2/31 Direct 0 0 1.1.1.2 GE0/1
1.1.1.2/32 Direct 0 0 127.0.0.1 InLoop0
6.6.6.1/32 Direct 0 0 127.0.0.1 InLoop0
6.6.6.2/32 O_INTRA 10 1 1.1.1.1 GE0/0
6.6.6.3/32 O_INTRA 10 1 1.1.1.3 GE0/1
6.6.6.4/32 BGP 255 0 6.6.6.2 GE0/0 //等价路由
BGP 255 0 6.6.6.3 GE0/1
6.6.6.6/32 Direct 0 0 127.0.0.1 InLoop0
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
127.255.255.255/32 Direct 0 0 127.0.0.1 InLoop0
224.0.0.0/4 Direct 0 0 0.0.0.0 NULL0
224.0.0.0/24 Direct 0 0 0.0.0.0 NULL0
255.255.255.255/32 Direct 0 0 127.0.0.1 InLoop0
<Leaf1>dis bgp routing-table ipv4 6.6.6.4
BGP local router ID: 6.6.6.1
Local AS number: 100
Paths: 2 available, 2 best
BGP routing table information of 6.6.6.4/32:
From : 6.6.6.2 (6.6.6.2)
Rely nexthop : 1.1.1.1
Original nexthop: 6.6.6.2
OutLabel : NULL
AS-path : 200
Origin : igp
Attribute value : MED 0, localpref 100, pref-val 0
State : valid, internal, best
IP precedence : N/A
QoS local ID : N/A
Traffic index : N/A
VPN-Peer UserID : N/A
DSCP : N/A
EXP : N/A
Tunnel policy : NULL
Rely tunnel IDs : N/A
From : 6.6.6.3 (6.6.6.3)
Rely nexthop : 1.1.1.3
Original nexthop: 6.6.6.3
OutLabel : NULL
AS-path : 200
Origin : igp
Attribute value : MED 0, localpref 100, pref-val 0
State : valid, internal, best
IP precedence : N/A
QoS local ID : N/A
Traffic index : N/A
VPN-Peer UserID : N/A
DSCP : N/A
EXP : N/A
Tunnel policy : NULL
Rely tunnel IDs : N/A
<Leaf1>dis bgp routing-table ipv4 6.6.6.4 advertise-info
BGP local router ID: 6.6.6.1
Local AS number: 100
Paths: 1 best
BGP routing table information of 6.6.6.4/32:
Not advertised to any peers yet
<Leaf1>