09 Preferred BGP Route Selection

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 63

Preferred BGP Route Selection

Page 1 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Foreword
• The border gateway protocol (BGP) is a widely deployed routing protocol in the globe. BGP
defines multiple path attributes and has various routing policy tools, providing flexible route
control and path selection.
• Operations on BGP route attributes may affect route selection and therefore affect network
traffic. Therefore, it is important to master Rules for Selecting a Preferred BGP Route.
• This course illustrates Rules for Selecting a Preferred BGP Route.

Page 2 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Objectives
• Upon completion of this course, you will be able to:
▫ Describe rules for selecting a preferred BGP route.

▫ Learn BGP route control.

Page 3 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Contents
1. Preferred BGP Route Selection

Page 4 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Rules for Selecting a Preferred BGP Route
When multiple routes to the same destination network segment exist, BGP selects routes in the following sequence:

Discards the route whose next hop is unreachable.


1. Prefers the route with the largest Preferred-Value attribute value. ↑ A larger value indicates a
2. Prefers the route with the largest Local_Preference value. better route.
3. Prefers the locally originated BGP route, which takes precedence over the route learned from a peer. The locally summarized route, automatically summarized route, route
learned by using the network command, route learned by using the import-route command, and route learned from a peer are in descending order of priority.

4. Prefers the route with the shortest AS_Path.

5. Prefers the route with the shortest AS_Path. The routes with Origin attributes of IGP, EGP, and Incomplete are in descending order of priority.

6. Prefers the route with the lowest MED.

7. Prefers routes learned from EBGP peers to routes learned from IBGP peers. ↓ A smaller value indicates a
8. Prefers the route with the smallest IGP metric to the next hop. better route.
9. Prefers the route with the shortest Cluster_List length. If the preceding eight attributes are the same, routes
10. Prefers the route advertised by the device with the smallest router ID (Originator_ID). work in load balancing mode.

11. Prefers the route learned from the peer with the smallest IP address.

Page 5 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Topology (1)
AS 200
R2 GE0/0/0 GE0/0/0 R1 GE0/0/1 GE0/0/0 R3
10.0.12.2/24 10.0.12.1/24 10.0.13.1/24 10.0.13.3/24

GE0/0/1 OSPF GE0/0/1


10.0.24.2/24 10.0.35.3/24

GE0/0/0 GE0/0/0
10.0.24.4/24 10.0.35.5/24

AS 100 R4 R5 AS 300

10.0.45.0/24

• The figure shows ASs and interconnection addresses. Loopback0 interfaces are created on all devices, and the IP address is 10.0.x.x
(x indicates the device ID). All devices use addresses of Loopback0 interfaces as router IDs.

• OSPF runs in AS 200 and OSPF is enabled on internal interconnection interfaces (excluding the interfaces connected to external AS)
and loopback interfaces.

Page 6 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Topology (2)
AS 200
R2 IBGP R1 IBGP R3

OSPF

EBGP EBGP

AS 100 R4 R5 AS 300

10.0.45.0/24

• Loopback0 interfaces are used for establishing IBGP peer relationships in ASs, and directly connected interfaces are used for
establishing EBGP peer relationships between ASs.

• R4 and R5 have the same network segment 10.0.45.0/24. The import-route command can be used to import the direct routes of this
network segment to BGP so as to verify BGP route selection.

Page 7 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Rules for Selecting a Preferred BGP Route
When multiple routes to the same destination network segment exist, BGP selects routes in the following sequence:
Discards the route whose next hop is unreachable.

1. Prefers the route with the largest Preferred-Value attribute value.

2. Prefers the route with the largest Local_Preference value.

3. Prefers the locally originated BGP route, which takes precedence over the route learned from a peer. The locally summarized route, automatically summarized route, route
learned by using the network command, route learned by using the import-route command, and route learned from a peer are in descending order of priority.

4. Prefers the route with the shortest AS_Path.

5. Prefers the route with the shortest AS_Path. The routes with Origin attributes of IGP, EGP, and Incomplete are in descending order of priority.

6. Prefers the route with the lowest MED.

7. Prefers routes learned from EBGP peers to routes learned from IBGP peers.

8. Prefers the route with the smallest IGP metric to the next hop.

9. Prefers the route with the shortest Cluster_List length.

10. Prefers the route advertised by the device with the smallest router ID (Originator_ID).

11. Prefers the route learned from the peer with the smallest IP address.

Page 8 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Discarding the Route Whose Next Hop Is
Unreachable (1)
BGP Update
Total Number of Routes: 2 • When R4 and R5 advertise the BGP routes
Network NextHop MED LocPrf PrefVal Path/Ogn
10.0.45.0/24 to AS 200, the Next_Hop attribute values
i 10.0.45.0/24 10.0.24.4 0 100 0 100? of the routes are 10.0.24.4 and 10.0.34.5.
i 10.0.35.5 0 100 0 300?
• R2 and R3 do not modify the Next_Hop attribute
when advertising routes to R1. The next hops of the
AS 200 two BGP routes 10.0.45.0/24 learned by R1 are
10.0.24.4 and 10.0.34.5.
R2 R1 R3
• When R1 performs recursive query for next hops of
BGP routes, route recursion fails because OSPF is not
OSPF activated on the interfaces connecting R2 and R3 to
BGP Update BGP Update
external ASs. As a result, the next hop of the BGP
….. …..
Path Attribute: Path Attribute: route 10.0.45.0/24 on R1 is unreachable.
Nexthop 10.0.24.4 Nexthop 10.0.35.5
• Run the display bgp routing command on R1 to
AS 100 R4 R5 AS 300 check the BGP routing table. The command output
shows that the BGP route 10.0.45.0/24 is invalid.
10.0.45.0/24

Page 9 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Discarding the Route Whose Next Hop Is
Unreachable (2)
BGP Update
bgp 200
Peer 10.0.1.1 next-hop-local

• Run the next-hop-local command on R2 and R3


AS 200 to change the Next_Hop attribute value to the
R2 R1 R3 local source address.

• When R2 and R3 advertise BGP routes to R1, the


OSPF Next_Hop attribute values of the routes are
BGP Update BGP Update
changed to 10.0.2.2 and 10.0.3.3.
… …
Path Attribute: Path Attribute: • The two next-hop addresses can be successfully
Nexthop 10.0.2.2 Nexthop 10.0.3.3
recursed on R1, and the next-hop address of the
AS 100 R4 R5 AS 300
BGP route becomes reachable.

10.0.45.0/24

Unless otherwise specified, devices in all subsequent cases use basic configuration. In addition to
the basic configuration, R2 and R3 are configured with peer next-hop-local.

Page 10 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Discarding the Route Whose Next Hop Is
Unreachable (3)
BGP Update Total Number of Routes: 2
Network NextHop MED LocPrf PrefVal Path/Ogn

*>i 10.0.45.0/24 10.0.2.2 0 100 0 100?


*i 10.0.3.3 0 100 0 300?

Run the display bgp routing command on R1 to check the


AS 200 BGP routing table. The command output shows that the BGP
R2 R1 route 10.0.45.0/24R3
is valid.

OSPF
BGP Update BGP Update

... ...
Path Attribute: Path Attribute:
Nexthop 10.0.2.2 Nexthop 10.0.3.3

AS 100 R4 R5 AS 300

10.0.45.0/24

Why is the BGP route with the next hop of 10.0.2.2 the optimal route when next hops of two BGP routes are reachable?

Page 11 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Rules for Selecting a Preferred BGP Route
When multiple routes to the same destination network segment exist, BGP selects routes in the following sequence:
Discards the route whose next hop is unreachable.

1. Prefers the route with the largest Preferred-Value attribute value.

2. Prefers the route with the largest Local_Preference value.

3. Prefers the locally originated BGP route, which takes precedence over the route learned from a peer. The locally summarized route, automatically summarized route, route
learned by using the network command, route learned by using the import-route command, and route learned from a peer are in descending order of priority.

4. Prefers the route with the shortest AS_Path.

5. Prefers the route with the shortest AS_Path. The routes with Origin attributes of IGP, EGP, and Incomplete are in descending order of priority.

6. Prefers the route with the lowest MED.

7. Prefers routes learned from EBGP peers to routes learned from IBGP peers.

8. Prefers the route with the smallest IGP metric to the next hop.

9. Prefers the route with the shortest Cluster_List length.

10. Prefers the route advertised by the device with the smallest router ID (Originator_ID).

11. Prefers the route learned from the peer with the smallest IP address.

Page 12 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Changing the Preferred-Value Attribute
R1 sends data packets to 10.0.45.0/24. bgp 200
BGP Update
peer 10.0.3.3 preferred-value 100

AS 200 Run the preferred-value command to change


R2 R1 R3 the Preferred-Value attribute value of the BGP
route advertised by R3 to 100, which takes
OSPF precedence over the BGP route with the
default Preferred-Value attribute value
advertised by R2. Then R1 preferentially

AS 300 selects the BGP route 10.0.45.0/24 advertised


AS 100 R4 R5
by R3.
10.0.45.0/24

Page 13 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Checking the BGP Routing Table of R1

[R1] display bgp routing-table


BGP Local router ID is 10.0.1.1
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete

Total Number of Routes: 4


Network NextHop MED LocPrf PrefVal Path/Ogn
*>i 10.0.45.0/24 10.0.3.3 0 100 300 i
*i 10.0.2.2 0 0 100 i

The BGP route advertised by R3 at 10.0.3.3 has a higher Preferred-Value attribute value (100), so R1 prefers the BGP
route 10.0.45.0/24 advertised by R3.
Page 14 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Rules for Selecting a Preferred BGP Route
When multiple routes to the same destination network segment exist, BGP selects routes in the following sequence:
Discards the route whose next hop is unreachable.

1. Prefers the route with the largest Preferred-Value attribute value.

2. Prefers the route with the largest Local_Preference value.

3. Prefers the locally originated BGP route, which takes precedence over the route learned from a peer. The locally summarized route, automatically summarized route, route
learned by using the network command, route learned by using the import-route command, and route learned from a peer are in descending order of priority.

4. Prefers the route with the shortest AS_Path.

5. Prefers the route with the shortest AS_Path. The routes with Origin attributes of IGP, EGP, and Incomplete are in descending order of priority.

6. Prefers the route with the lowest MED.

7. Prefers routes learned from EBGP peers to routes learned from IBGP peers.

8. Prefers the route with the smallest IGP metric to the next hop.

9. Prefers the route with the shortest Cluster_List length.

10. Prefers the route advertised by the device with the smallest router ID (Originator_ID).

11. Prefers the route learned from the peer with the smallest IP address.

Page 15 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Changing the Local_Preference Attribute (1)

BGP Update
Run the following commands on R3.
AS 200
R2 R1 R3 ip ip-prefix local_pref index 10 permit 10.0.45.0 24
#
route-policy local_pref permit node 10
OSPF
BGP Update BGP Update if-match ip-prefix local_pref

... ... apply local-preference 200


Path Attribute: Path Attribute:
LocPrf 100 LocPrf 200
route-policy local_pref permit node 20
#
AS 100 R4 R5 AS 300
bgp 200
peer 10.0.1.1 route-policy local_pref export
10.0.45.0/24

Configure a routing policy on R3 to change the Local_Preference value of the BGP route 10.0.45.0/24 advertised to R1.

Page 16 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Changing the Local_Preference Attribute (2)
Total Number of Routes: 2
Network NextHop MED LocPrf PrefVal Path/Ogn

*>i 10.0.45.0/24 10.0.3.3 0 200 0 300?


*i 10.0.2.2 0 100 0 100?

BGP Update

AS 200 If the next hops of the routes are reachable and


R2 R1 R3 the Preferred-Value attribute values of the routes
are the same, R1 compares the Local_Preference
OSPF attribute values of the routes. The
BGP Update BGP Update
Local_Preference attribute value of the BGP
... ...
Path Attribute: Path Attribute: route advertised by R3 is 200, which is greater
LocPrf 100 LocPrf 200
than that of the BGP route advertised by R2.
AS 100 R4 R5 AS 300
Therefore, R1 prefers the BGP route advertised
by R3.
10.0.45.0/24

Page 17 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Rules for Selecting a Preferred BGP Route
When multiple routes to the same destination network segment exist, BGP selects routes in the following sequence:
Discards the route whose next hop is unreachable.

1. Prefers the route with the largest Preferred-Value attribute value.

2. Prefers the route with the largest Local_Preference value.

3. Prefers the locally originated BGP route, which takes precedence over the route learned from a peer. The locally summarized route, automatically summarized
route, route learned by using the network command, route learned by using the import-route command, and route learned from a peer are in descending order of
priority.

4. Prefers the route with the shortest AS_Path.

5. Prefers the route with the shortest AS_Path. The routes with Origin attributes of IGP, EGP, and Incomplete are in descending order of priority.

6. Prefers the route with the lowest MED.

7. Prefers routes learned from EBGP peers to routes learned from IBGP peers.

8. Prefers the route with the smallest IGP metric to the next hop.

9. Prefers the route with the shortest Cluster_List length.

10. Prefers the route advertised by the device with the smallest router ID (Originator_ID).

11. Prefers the route learned from the peer with the smallest IP address.

Page 18 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Preferring the Locally Generated Route
• In the case of identical conditions, a locally generated route is preferred, and the route learned from a peer
has the secondary priority.

• In addition, locally generated routes may be learned in multiple ways. When the same route is learned in
multiple ways, the following routes are in descending order of priority:
▫ Summarized route by manually running the aggregate command in the BGP view

▫ Automatically summarized route by running the summary automatic command

▫ Route imported using the network command

▫ Route imported using the import-route command

Page 19 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Manual Route Summarization (1)

AS 200 • Run the following commands on R3.


R1 R3
ip route-static 10.0.45.0 255.255.255.128 null0
ip route-static 10.0.45.128 255.255.255.128 null0
OSPF bgp 200
aggregate 10.0.45.0 255.255.255.0 detail-suppressed
import-route static

R5 AS 300 • Configure two static routes on R3, import the static routes to
BGP using the import-route command, run the aggregate
10.0.45.0/24 command to manually summarize the routes, and specify
To manually summarize routes on R3, configure two static routes detail-suppressed suppress advertisement of specific routes.
pointing to null0 on R3 and import them to BGP.

Page 20 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Manual Route Summarization (2)

Network NextHop MED LocPrf PrefVal Path/Ogn

*> 10.0.45.0/24 127.0.0.1 0 ?


AS 200 * 10.0.35.5 0 0 300?
s> 10.0.45.0/25 0.0.0.0 0 0 ?
R1 R3 s> 10.0.45.128/25 0.0.0.0 0 0 ?

• The BGP routing table of R3 contains two BGP routes


OSPF 10.0.45.0/24.
▫ Locally generated route: Static routes are imported to BGP and are
manually summarized.

R5 AS 300 ▫ Route advertised by R5 at 10.0.35.5

• The two routes do not have Local_Preference or Preferred-


10.0.45.0/24
Value attribute values on R3. R3 then compares the source of
the two routes and prefers the route that is manually
summarized.

Page 21 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Manual Route Summarization (3)

[R3]display bgp routing-table 10.0.45.0 24


BGP local router ID : 10.0.3.3
Local AS number : 200
• Run the display bgp routing-table 10.0.45.0 24 command on R3
Paths: 2 available, 1 best, 1 select to check detailed information about BGP route 10.0.45.0/24. The
BGP routing table entry information of 10.0.45.0/24: command output shows that there are two valid routes, and the
Aggregated route.
manually summarized route is better.
Route Duration: 00h00m14s
Direct Out-interface: NULL0 • This example verifies that the locally generated BGP route is
Original nexthop: 127.0.0.1
better than the BGP route learned from a peer.
Qos information : 0x0
AS-path Nil, origin incomplete, pref-val 0, valid, local, best, select, active,
pre 255
Aggregator: AS 200, Aggregator ID 10.0.3.3, Atomic-aggregate
Advertised to such 2 peers:
10.0.35.5
10.0.1.1

Page 22 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Automatic Route Summarization (1)
• Run the following commands on R3.

ip route-static 10.0.45.0 255.255.255.128 null0


AS 200
ip route-static 10.0.45.128 255.255.255.128 null0
R1 R3

bgp 200
OSPF summary automatic
import-route static

• Configure two static routes on R3, import the static routes to BGP using the
import-route command, and enable automatic summarization. BGP
R5 AS 300
summarizes routes by natural network segment. For example, class A
addresses 10.1.1.1/24 and 10.2.1.1/24 on the non-natural network segment are
10.0.45.0/24, 10.0.0.0/8 summarized into class A address 10.0.0.0/8 on the natural network segment. In
addition, BGP advertises only the summarized route to peers.
In this case, the configurations on R1, R3, and R5 are irrelevant to • On R3, you can view that the route is summarized to 10.0.0.0/8.
the configurations that have been performed in the example of
• R5 imports the route 10.0.0.0/8 and advertises it to R3.
manual summarization.

Page 23 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Automatic Route Summarization (2)

Network NextHop MED LocPrf PrefVal Path/Ogn


AS 200
*> 10.0.0.0 127.0.0.1 0 ?
R1 R3 * 10.0.35.5 0 0 300?

• The BGP routing table on R3 contains two BGP routes


OSPF 10.0.0.0.
▫ Locally generated route: Static routes are imported to BGP and
automatically aggregated.

R5 AS 300 ▫ Route advertised by R5 at 10.0.35.5

• The two routes do not have Local_Preference or Preferred-


10.0.45.0/24, 10.0.0.0/8
Value attribute values on R3. R3 then compares the source of
the two routes and prefers the route that is automatically
summarized.
Page 24 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Automatic Route Summarization (3)

• Perform manual summarization on R3.


AS 200
bgp 200
R1 R3
aggregate 10.0.0.0 255.0.0.0 detail-suppressed

OSPF • Check the routing table of R3.


Network NextHop MED LocPrf PrefVal Path/Ogn

*> 10.0.0.0 127.0.0.1 0 ?


* 127.0.0.1 0 ?
AS 300 * 10.0.35.5 0 0 300?
R5

• The locally generated BGP route is preferred. However, there are two
10.0.45.0/24, 10.0.0.0/8
locally generated BGP routes, and the routing entry cannot help
determine whether the preferred route is manually or automatically
summarized.

Page 25 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Automatic Route Summarization (4)

BGP local router ID : 10.0.3.3 • Run the display bgp routing-table 10.0.0.0 command on R3 to
Local AS number : 200
check detailed information about the BGP route 10.0.0.0/8. The
Paths: 3 available, 1 best, 1 select
BGP routing table entry information of 10.0.0.0/8:
command output shows that there are three valid routes, among
Aggregated route. which the optimal route is generated by route summarization and
Route Duration: 00h08m17s has the Atomic-aggregate attribute. The command output shows
Direct Out-interface: NULL0
that the route is manually summarized.
Original nexthop: 127.0.0.1
Qos information : 0x0 • On R3, the manually summarized route is better than the
AS-path Nil, origin incomplete, pref-val 0, valid, local, best, select, active, automatically summarized route.
pre 255
Aggregator: AS 200, Aggregator ID 10.0.3.3, Atomic-aggregate • This example verifies that the manually summarized route is
Advertised to such 2 peers: better than the automatically summarized route.
10.0.35.5
10.0.1.1

Page 26 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Rules for Selecting a Preferred BGP Route
When multiple routes to the same destination network segment exist, BGP selects routes in the following sequence:
Discards the route whose next hop is unreachable.

1. Prefers the route with the largest Preferred-Value attribute value.

2. Prefers the route with the largest Local_Preference value.

3. Prefers the locally originated BGP route, which takes precedence over the route learned from a peer. The locally summarized route, automatically summarized route, route
learned by using the network command, route learned by using the import-route command, and route learned from a peer are in descending order of priority.

4. Prefers the route with the shortest AS_Path.

5. Prefers the route with the shortest AS_Path. The routes with Origin attributes of IGP, EGP, and Incomplete are in descending order of priority.

6. Prefers the route with the lowest MED.

7. Prefers routes learned from EBGP peers to routes learned from IBGP peers.

8. Prefers the route with the smallest IGP metric to the next hop.

9. Prefers the route with the shortest Cluster_List length.

10. Prefers the route advertised by the device with the smallest router ID (Originator_ID).

11. Prefers the route learned from the peer with the smallest IP address.

Page 27 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Preferring the Route with the Shortest AS_Path
(1)
BGP Update

AS 200
R2 R1 R3
C
OSPF
ip ip-prefix as_path index 10 permit 10.0.45.0 24 BGP Update BGP Update

... ...
#
Path Attribute: Path Attribute:
route-policy as_path permit node 10 AS_Path: 400 100 AS_Path: 300

if-match ip-prefix as_path AS 100 R4 R5 AS 300


apply as-path 400 additive
route-policy as_path permit node 20 10.0.45.0/24
#
bgp 200 Configure a routing policy on R2 to change the AS_Path attribute value of the
BGP route advertised to R1.
peer 10.0.1.1 route-policy local_pref export

Page 28 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Preferring the Route with the Shortest AS_Path
(2)

Total Number of Routes: 2


Network NextHop MED LocPrf PrefVal Path/Ogn

*>i 10.0.45.0/24 10.0.3.3 0 100 0 300?


*i 10.0.2.2 0 100 0 400 100?
The BGP route advertised by R3 has a shorter AS_Path. If the
preceding rules are the same, R1 preferentially selects the BGP
AS 200
route advertised by R3.
R2 R1 R3

OSPF
BGP Update BGP Update

... ...
Path Attribute: Path Attribute:
AS_Path: 400 100 AS_Path: 300

AS 100 R4 R5 AS 300

10.0.45.0/24

Page 29 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Rules for Selecting a Preferred BGP Route
When multiple routes to the same destination network segment exist, BGP selects routes in the following sequence:
Discards the route whose next hop is unreachable.

1. Prefers the route with the largest Preferred-Value attribute value.

2. Prefers the route with the largest Local_Preference value.

3. Prefers the locally originated BGP route, which takes precedence over the route learned from a peer. The locally summarized route, automatically summarized route, route
learned by using the network command, route learned by using the import-route command, and route learned from a peer are in descending order of priority.

4. Prefers the route with the shortest AS_Path.

5. Prefers the route with the shortest AS_Path. The routes with Origin attributes of IGP, EGP, and Incomplete are in descending order of priority.

6. Prefers the route with the lowest MED.

7. Prefers routes learned from EBGP peers to routes learned from IBGP peers.

8. Prefers the route with the smallest IGP metric to the next hop.

9. Prefers the route with the shortest Cluster_List length.

10. Prefers the route advertised by the device with the smallest router ID (Originator_ID).

11. Prefers the route learned from the peer with the smallest IP address.

Page 30 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Origin Attribute Verification (1)
Total Number of Routes: 2
Network NextHop MED LocPrf PrefVal Path/Ogn

*>i 10.0.45.0/24 10.0.2.2 0 100 0 100?


BGP Update *i 10.0.3.3 0 100 0 300?

AS 200 • By default, R4 and R5 use the import-route


R2 R1 R3 command to import the routes 10.0.45.0/24
to BGP. In the BGP routing table of R1, the
OSPF Origin attributes of the two BGP routes
BGP Update BGP Update

... ... 10.0.45.0/24 are both "?". R1 preferentially


Path Attribute:
Origin: ?
Path Attribute:
Origin: ?
selects the BGP route imported by R4.

AS 100 R4 R5 AS 300 • Change the command used to import routes


to network on R5.
10.0.45.0/24
• Check the BGP routing table on R1.

Page 31 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Origin Attribute Verification (2)
Total Number of Routes: 2
Network NextHop MED LocPrf PrefVal Path/Ogn

*>i 10.0.45.0/24 10.0.3.3 0 100 0 300i


BGP Update *i 10.0.2.2 0 100 0 100?

AS 200
R2 R1 R3
The Origin attribute of the BGP route
10.0.45.0/24 imported by R5 is “i”. If the
OSPF
BGP Update BGP Update preceding rules are the same, the BGP route
... ...
with the origin type being “i” becomes the
Path Attribute: Path Attribute:
Origin: ? Origin: i optimal route.
AS 100 R4 R5 AS 300

10.0.45.0/24

Page 32 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Rules for Selecting a Preferred BGP Route
When multiple routes to the same destination network segment exist, BGP selects routes in the following sequence:
Discards the route whose next hop is unreachable.

1. Prefers the route with the largest Preferred-Value attribute value.

2. Prefers the route with the largest Local_Preference value.

3. Prefers the locally originated BGP route, which takes precedence over the route learned from a peer. The locally summarized route, automatically summarized route, route
learned by using the network command, route learned by using the import-route command, and route learned from a peer are in descending order of priority.

4. Prefers the route with the shortest AS_Path.

5. Prefers the route with the shortest AS_Path. The routes with Origin attributes of IGP, EGP, and Incomplete are in descending order of priority.

6. Prefers the route with the lowest MED.

7. Prefers routes learned from EBGP peers to routes learned from IBGP peers.

8. Prefers the route with the smallest IGP metric to the next hop.

9. Prefers the route with the shortest Cluster_List length.

10. Prefers the route advertised by the device with the smallest router ID (Originator_ID).

11. Prefers the route learned from the peer with the smallest IP address.

Page 33 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Preferring the Route with the Smallest MED (1)

ip ip-prefix med index 10 permit 10.0.45.0 24 BGP Update


#
AS 200
route-policy med permit node 10
if-match ip-prefix med R2 R1 R3

apply cost 20
route-policy med permit node 20 OSPF
# BGP Update BGP Update

... ...
bgp 200
Path Attribute: Path Attribute:
peer 10.0.1.1 route-policy med export MED: 20 No MED value

compare-different-as-med AS 100 R4 R5 AS 300

By default, BGP compares the MED values of 10.0.45.0/24


routes from the same AS and to the same network
segment. You can use a command to enable BGP to Configure a routing policy on R2 to change the MED attribute
compare the MED attribute values of the same values of the BGP routes advertised to R1.
routes from different ASs.

Page 34 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Preferring the Route with the Smallest MED (2)
Total Number of Routes: 2
Network NextHop MED LocPrf PrefVal Path/Ogn

*>i 10.0.45.0/24 10.0.3.3 0 100 0 300 ?


*i 10.0.2.2 20 100 0 100?
BGP Update
The MED value of the BGP route advertised by R4 is 20, and the BGP route advertised by R5 does not

AS 200 carry the MED value (the default MED value is 0). The BGP route advertised by R5 has a smaller MED
value, and R1 preferentially selects the BGP route advertised by R5.
R2 R1 R3

OSPF
BGP Update BGP Update

… …
Path Attribute: Path Attribute:
MED: 20 No MED

AS 100 R4 R5 AS 300

10.0.45.0/24

Page 35 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Rules for Selecting a Preferred BGP Route
When multiple routes to the same destination network segment exist, BGP selects routes in the following sequence:
Discards the route whose next hop is unreachable.

1. Prefers the route with the largest Preferred-Value attribute value.

2. Prefers the route with the largest Local_Preference value.

3. Prefers the locally originated BGP route, which takes precedence over the route learned from a peer. The locally summarized route, automatically summarized route, route
learned by using the network command, route learned by using the import-route command, and route learned from a peer are in descending order of priority.

4. Prefers the route with the shortest AS_Path.

5. Prefers the route with the shortest AS_Path. The routes with Origin attributes of IGP, EGP, and Incomplete are in descending order of priority.

6. Prefers the route with the lowest MED.

7. Prefers routes learned from EBGP peers to routes learned from IBGP peers.

8. Prefers the route with the smallest IGP metric to the next hop.

9. Prefers the route with the shortest Cluster_List length.

10. Prefers the route advertised by the device with the smallest router ID (Originator_ID).

11. Prefers the route learned from the peer with the smallest IP address.

Page 36 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Preferring a Route Learned from an EBGP Peer
(1)
AS 200 10.0.45.0/24 • Run the following commands on R1.

R1 R3 ip route-static 10.0.45.0 255.255.255.0 null0


ip ip-prefix ebgp index 10 permit 10.0.45.0 24

OSPF #
route-policy ebgp permit node 10
if-match ip-prefix ebgp
apply as-path 500 additive

R5 AS 300 route-policy ebgp permit node 20


#

10.0.45.0/24 bgp 200


import-route static
Create a static route 10.0.45.0/24 pointing to null0 on R1 and advertise the
peer 10.0.3.3 route-policy ebgp export
route to BGP. Ensure that the AS_Path attribute values of the BGP routes
advertised by R1 and R5 to R3 are the same, configure a routing policy to • R3 will receive the BGP route 10.0.45.0/24 advertised by R1 and R5,
add the AS_Path attribute to the route advertised by R1 to R3. The AS_Path and the preceding route selection rules cannot determine the optimal
attribute value is 500. route.

Page 37 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Preferring a Route Learned from an EBGP Peer
(2)

AS 200 10.0.45.0/24

R1 R3

Network NextHop MED LocPrf PrefVal Path/Ogn


OSPF
*> 10.0.45.0/24 10.0.35.5 0 0 300?
*i 10.0.1.1 0 100 0 500?

R5 and R1 are the EBGP peer and IBGP peer, respectively. The
R5 AS 300
BGP routes advertised by EBGP peers take precedence over the
BGP routes advertised by IBGP peers. R3 preferentially selects
10.0.45.0/24
the BGP routes advertised by R5.

Page 38 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Preferring a Route Learned from an EBGP Peer
(3)

BGP routing table entry information of 10.0.45.0/24:


From: 10.0.1.1 (10.0.1.1)
Run the display bgp routing-table 10.0.45.0 24 command on R3 to
Route Duration: 00h06m43s
check detailed information about BGP routes. The command output
Relay IP Nexthop: 10.0.13.1
Relay IP Out-Interface: GigabitEthernet0/0/0 is as follows:
Original nexthop: 10.0.1.1
not preferred for peer type
Qos information : 0x0
AS-path 500, origin incomplete, MED 0, localpref 100, pref-val 0, valid, internal, The route is not selected because the peer type is not preferred.
pre 255, IGP cost 1, not preferred for peer type
Not advertised to any peer yet

Page 39 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Rules for Selecting a Preferred BGP Route
When multiple routes to the same destination network segment exist, BGP selects routes in the following sequence:
Discards the route whose next hop is unreachable.

1. Prefers the route with the largest Preferred-Value attribute value.

2. Prefers the route with the largest Local_Preference value.

3. Prefers the locally originated BGP route, which takes precedence over the route learned from a peer. The locally summarized route, automatically summarized route, route
learned by using the network command, route learned by using the import-route command, and route learned from a peer are in descending order of priority.

4. Prefers the route with the shortest AS_Path.

5. Prefers the route with the shortest AS_Path. The routes with Origin attributes of IGP, EGP, and Incomplete are in descending order of priority.

6. Prefers the route with the lowest MED.

7. Prefers routes learned from EBGP peers to routes learned from IBGP peers.

8. Prefers the route with the smallest IGP metric to the next hop.

9. Prefers the route with the shortest Cluster_List length.

10. Prefers the route advertised by the device with the smallest router ID (Originator_ID).

11. Prefers the route learned from the peer with the smallest IP address.

Page 40 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
IGP Cost

BGP local router ID : 10.0.1.1


Local AS number : 200 • The IGP cost is displayed in the detailed BGP route
Paths: 2 available, 1 best, 1 select information. The IGP cost is the cost of the route to the original
BGP routing table entry information of 10.0.45.0/24:
next hop in the local IP routing table.
From: 10.0.3.3 (10.0.3.3)
Route Duration: 00h22m35s
Destination/Mask Proto Pre Cost NextHop Interface
Relay IP Nexthop: 10.0.13.3
10.0.3.3/32 OSPF 10 1 10.0.13.3 GigabitEthernet0/0/1
Relay IP Out-Interface: GigabitEthernet0/0/1
Original nexthop: 10.0.3.3
• If the preceding seven rules cannot determine the optimal BGP
Qos information : 0x0
AS-path 300, origin incomplete, MED 0, localpref 100, pref-val 0, valid, internal, route, the IGP cost of the next hop is compared.
best, select, active, pre 255, IGP cost 1
Not advertised to any peer yet

Page 41 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Preferring the Route with the Smallest IGP Cost
(1)

BGP Update

AS 200
R2 R1 R3

OSPF

Change the OSPF cost of


the interface to 10
AS 100 R4 R5 AS 300

10.0.45.0/24

Page 42 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Preferring the Route with the Smallest IGP Cost
(2)
Total Number of Routes: 2
Network NextHop MED LocPrf PrefVal Path/Ogn

*>i 10.0.45.0/24 10.0.3.3 0 100 0 300?


*i 10.0.2.2 0 100 0 100?
BGP Update
On R1, the IGP cost to 10.0.3.3 is 1 (default value), and the IGP cost to 10.0.2.2 is
AS 200 10.

R2 R1 R1 preferentially selectsR3
the BGP route with the next hop being 10.0.3.3.

OSPF

AS 100 R4 R5 AS 300

10.0.45.0/24

Page 43 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Preferring the Route with the Smallest IGP Cost
(3)

• Run the display bgp routing-table 10.0.45.0 24 command on


R1 to check detailed information about BGP routes. The
BGP routing table entry information of 10.0.45.0/24: command output shows that the IGP cost of the BGP route with
From: 10.0.2.2 (10.0.2.2)
the next hop being 10.0.2.2 changes to 10 and the IGP cost of
Route Duration: 00h24m07s
the BGP route with the next hop being 10.0.3.3 is 1 (default
Relay IP Nexthop: 10.0.12.2
Relay IP Out-Interface: GigabitEthernet0/0/0 value). Therefore, R1 preferentially selects the BGP route with
Original nexthop: 10.0.2.2 the next hop being 10.0.3.3.
Qos information : 0x0
AS-path 100, origin incomplete, MED 0, localpref 100, pref-val 0, valid, internal,
• The following information is displayed in the detailed routing
pre 255, IGP cost 10, not preferred for IGP cost information of R1:
Not advertised to any peer yet
not preferred for IGP cost

The route is not selected because of the IGP cost.

Page 44 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Load Balancing Among BGP Routes
• On a large network, there may be multiple valid BGP routes to the same destination. The device will
select and add the optimal BGP route to its routing table for traffic forwarding.

• This, however, will result in uneven load balancing of much traffic. Configuring BGP load balancing can
enable the device to add these multiple equal-cost BGP routes to its routing table, implementing traffic
load balancing and reducing network congestion.

• After BGP load balancing is configured, the device will still select the optimal route among the multiple
routes and advertise only this route to its peers.

• After BGP load balancing is enabled on a device, only the BGP routes that meet specified conditions can
be used as equal-cost routes for load balancing.

Page 45 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Conditions for Load Balancing Among Equal-Cost
BGP Routes
• The Preferred-Value attribute values are the same.

• The Local_Preference attribute values are the same.

• All the routes are summarized or non-summarized routes.

• AS_Path attribute values are the same.

• Origin types (IGP, EGP, or incomplete) are the same.

• The MED attribute values are the same.

• All the routes are EBGP or IBGP routes.

• The IGP metric values within an AS are the same.

• AS_Path attribute values are the same.

Page 46 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Configuring BGP Load Balancing

bgp 200
maximum load-balancing ibgp 2
BGP Update

AS 200 In the figure, if no routing policy or configuration


R2 R1 R3 is performed for the two BGP routes on R1, the
first eight rules cannot determine the optimal
OSPF route. Therefore, you can configure load
balancing among IBGP routes.

R4 R5

10.0.45.0/24 AS 45

Page 47 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Verifying the Configuration of Load Balancing
Among BGP Routes
[R1]display ip routing-table 10.0.45.0 24 The equal-cost routes to 10.0.45.0/24 exist in the IP routing table.
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Table : Public
Summary Count : 2
Destination/Mask Proto Pre Cost Flags NextHop Interface
10.0.45.0/24 IBGP 255 0 RD 10.0.2.2 GigabitEthernet0/0/0
IBGP 255 0 RD 10.0.3.3 GigabitEthernet0/0/1

[R1]display bgp routing-table There is only one optimal route in the BGP routing table.

BGP Local router ID is 10.0.1.1


Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Total Number of Routes: 2
Network NextHop MED LocPrf PrefVal Path/Ogn
*>i 10.0.45.0/24 10.0.2.2 0 100 0 45?
*i 10.0.3.3 0 100 0 45?

Page 48 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Rules for Selecting a Preferred BGP Route
When multiple routes to the same destination network segment exist, BGP selects routes in the following sequence:
Discards the route whose next hop is unreachable.

1. Prefers the route with the largest Preferred-Value attribute value.

2. Prefers the route with the largest Local_Preference value.

3. Prefers the locally originated BGP route, which takes precedence over the route learned from a peer. The locally summarized route, automatically summarized route, route
learned by using the network command, route learned by using the import-route command, and route learned from a peer are in descending order of priority.

4. Prefers the route with the shortest AS_Path.

5. Prefers the route with the shortest AS_Path. The routes with Origin attributes of IGP, EGP, and Incomplete are in descending order of priority.

6. Prefers the route with the lowest MED.

7. Prefers routes learned from EBGP peers to routes learned from IBGP peers.

8. Prefers the route with the smallest IGP metric to the next hop.

9. Prefers the route with the shortest Cluster_List length.

10. Prefers the route advertised by the device with the smallest router ID (Originator_ID).

11. Prefers the route learned from the peer with the smallest IP address.

Page 49 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Preferring the Route with the Shortest
Cluster_List Length (1)
• The following configuration is performed:
▫ Configure only R5 to advertise the route 10.0.45.0/24 to
IBGP
BGP.
AS 200
▫ Configure R1 as the RR and R3 as the client of R1.
R2 R1 R3
▫ Establish an IBGP peer relationship between R2 and R3
IBGP IBGP based on loopback interfaces.
RR Client
• R2 receives the BGP route 10.0.45.0/24 advertised by
R3 and the BGP route 10.0.45.0/24 reflected by R1.

R5 AS 300 • By default, the preceding rules cannot determine the

Route update sent by BGP


optimal route. In this case, the route is selected based on
10.0.45.0/24
Route update reflected by a BGP RR Cluster_List.

Page 50 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Preferring the Route with the Shortest
Cluster_List Length (2)
Total Number of Routes: 2
Network NextHop MED LocPrf PrefVal Path/Ogn

*>i 10.0.45.0/24 10.0.3.3 0 100 0 300 ?


*i 10.0.3.3 0 100 0 300 ?

IBGP
Based on the BGP routing table, it cannot be determined
AS 200
whether the BGP route reflected by R1 or advertised by R3
R2 R1 R3
is preferred. To check detailed information about BGP
IBGP
RR
IBGP
Client
routes, run the display bgp routing 10.0.45.0 24
command.

Route update sent by BGP


R5 AS 300
Route update reflected by a BGP RR

10.0.45.0/24

Page 51 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Preferring the Route with the Shortest
Cluster_List Length (3)

BGP routing table entry information of 10.0.45.0/24: • The route reflected by R1 is not the optimal route due to the
From: 10.0.1.1 (10.0.1.1)
following reason: not preferred for Cluster List
Route Duration: 00h03m10s
Relay IP Nexthop: 10.0.12.1 • The BGP route that R3 directly advertises to R2 does not pass
Relay IP Out-Interface: GigabitEthernet0/0/0 through the RR and therefore does not have the Cluster_List
Original nexthop: 10.0.3.3
attribute. That is, the Cluster_List attribute value of the BGP
Qos information : 0x0
AS-path 300, origin incomplete, MED 0, localpref 100, pref-val 0, valid, internal,
route advertised by R3 is considered as 0, which is smaller than
pre 255, IGP cost 2, not preferred for Cluster List the Cluster_List attribute value (1) of the BGP route reflected
Originator: 10.0.3.3 by R1. Therefore, the BGP route advertised by R3 is preferred.
Cluster list: 10.0.1.1
Not advertised to any peer yet

Page 52 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Rules for Selecting a Preferred BGP Route
When multiple routes to the same destination network segment exist, BGP selects routes in the following sequence:
Discards the route whose next hop is unreachable.

1. Prefers the route with the largest Preferred-Value attribute value.

2. Prefers the route with the largest Local_Preference value.

3. Prefers the locally originated BGP route, which takes precedence over the route learned from a peer. The locally summarized route, automatically summarized route, route
learned by using the network command, route learned by using the import-route command, and route learned from a peer are in descending order of priority.

4. Prefers the route with the shortest AS_Path.

5. Prefers the route with the shortest AS_Path. The routes with Origin attributes of IGP, EGP, and Incomplete are in descending order of priority.

6. Prefers the route with the lowest MED.

7. Prefers routes learned from EBGP peers to routes learned from IBGP peers.

8. Prefers the route with the smallest IGP metric to the next hop.

9. Prefers the route with the shortest Cluster_List length.

10. Prefers the route advertised by the device with the smallest router ID (Originator_ID).

11. Prefers the route learned from the peer with the smallest IP address.

Page 53 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Preferring the Route with the Smallest Router ID
(1)
Total Number of Routes: 2
Network NextHop MED LocPrf PrefVal Path/Ogn

BGP Update *>i 10.0.45.0/24 10.0.2.2 0 100 0 100?


*i 10.0.3.3 0 100 0 300?

AS 200
R2 R1 R3

OSPF

AS 100 R4 R5 AS 300

10.0.45.0/24

In the preceding topology, R1 receives BGP route 10.0.45.0/24 from both R2 and R3 by default, and the preceding route selection rules cannot determine
the optimal route. Therefore, R1 selects the BGP route advertised by the peer with the smallest router ID based on the preceding route selection rules. In
this example, the BGP route advertised by R2 is preferred.
Page 54 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Preferring the Route with the Smallest Router ID
(2)

BGP routing table entry information of 10.0.45.0/24:


From: 10.0.3.3 (10.0.3.3)
Route Duration: 00h40m15s
Check detailed information about the BGP routing table of R1. The
Relay IP Nexthop: 10.0.13.3
Relay IP Out-Interface: GigabitEthernet0/0/1 command output shows that the BGP route from 10.0.3.3 is not
Original nexthop: 10.0.3.3 preferred because of the router ID.
Qos information : 0x0
AS-path 300, origin incomplete, MED 0, localpref 100, pref-val 0, valid, internal,
pre 255, IGP cost 1, not preferred for router ID
Not advertised to any peer yet

Page 55 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Preferring the Route with the Smallest
Originator_ID (1)
Route update sent by BGP

Route update reflected by a BGP RR


IBGP
AS 100 R2 R4

RR
R1
OSPF 10.0.45.0/24

RR

R3 R5

If a BGP route carries the Originator_ID attribute, the router compares the Originator_ID values of the routes
and selects the BGP route with the smallest Originator_ID value.
Page 56 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Preferring the Route with the Smallest
Originator_ID (2)
Total Number of Routes: 2
BGP routing table entry information of 10.0.45.0/24:
Network NextHop MED LocPrf PrefVal Path/Ogn
From: 10.0.3.3 (10.0.3.3)
*>i 10.0.45.0/24 10.0.4.4 0 100 0 ?
Route Duration: 00h33m15s
*i 10.0.5.5 0 100 0 ?
Relay IP Nexthop: 10.0.13.3
R2 Relay IP Out-Interface: GigabitEthernet0/0/1
AS 100
Original nexthop: 10.0.5.5

RR Qos information : 0x0


R1
AS-path Nil, origin incomplete, MED 0, localpref 100, pref-val 0, valid, internal,
pre 255, IGP cost 2, not preferred for router ID
Originator: 10.0.5.5
RR Cluster list: 10.0.3.3
Not advertised to any peer yet

R3
The BGP route reflected by R3 is not selected because of the
Route update sent by BGP
router ID. The router ID here refers to the Originator ID (router
Route update reflected by a BGP RR
ID of the original route advertiser).

Page 57 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Rules for Selecting a Preferred BGP Route
When multiple routes to the same destination network segment exist, BGP selects routes in the following sequence:
Discards the route whose next hop is unreachable.

1. Prefers the route with the largest Preferred-Value attribute value.

2. Prefers the route with the largest Local_Preference value.

3. Prefers the locally originated BGP route, which takes precedence over the route learned from a peer. The locally summarized route, automatically summarized route, route
learned by using the network command, route learned by using the import-route command, and route learned from a peer are in descending order of priority.

4. Prefers the route with the shortest AS_Path.

5. Prefers the route with the shortest AS_Path. The routes with Origin attributes of IGP, EGP, and Incomplete are in descending order of priority.

6. Prefers the route with the lowest MED.

7. Prefers routes learned from EBGP peers to routes learned from IBGP peers.

8. Prefers the route with the smallest IGP metric to the next hop.

9. Prefers the route with the shortest Cluster_List length.

10. Prefers the route advertised by the device with the smallest router ID (Originator_ID).

11. Prefers the route learned from the peer with the smallest IP address.

Page 58 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Preferring the Route from the Device with the
Smallest IP Address (1)
Route update sent by BGP

Route update reflected by a BGP RR R2


AS 100

RR
R1 R4
RR client
OSPF Router ID 10.0.45.0/24
10.0.4.4

RR

R3

• If the preceding rules cannot determine the optimal route, the route from the device with the smallest IP address is
preferred.

• In the preceding topology, R2 and R3 are connected to R4. R4 functions as the RR client and advertises routes to
BGP only on R4. In this case, the BGP routes reflected by R2 and R3 have the same Originator ID 10.0.4.4.

Page 59 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Preferring the Route from the Device with the
Smallest IP Address (2)
Total Number of Routes: 2
Network NextHop MED LocPrf PrefVal Path/Ogn BGP routing table entry information of 10.0.45.0/24:

*>i 10.0.45.0/24 10.0.4.4 0 100 0 ? From: 10.0.3.3 (10.0.3.3)


*i 10.0.4.4 0 100 0 ? Route Duration: 00h01m07s
Relay IP Nexthop: 10.0.12.2
AS 100 R2
Relay IP Out-Interface: GigabitEthernet0/0/0
Original nexthop: 10.0.4.4
R1 RR Qos information : 0x0
AS-path Nil, origin incomplete, MED 0, localpref 100, pref-val 0, valid, intern
al, pre 255, IGP cost 2, not preferred for peer address
Originator: 10.0.4.4
RR Cluster list: 10.0.3.3
Not advertised to any peer yet

R3
The BGP route reflected by R3 is not selected because the peer address is
Route update sent by BGP larger. The peer address of the route reflected by R2 is 10.0.2.2, and the
Route update reflected by a BGP RR peer address of the route reflected by R3 is 10.0.3.3. Therefore, the BGP
route reflected by R3 is not selected.
Page 60 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Quiz
1. (Essay) When a BGP route received from an EBGP peer is advertised to an IBGP peer, how does the
EBGP peer change the value of the Next_Hop attribute to its own source address?
2. (TorF) If the preceding three rules are the same, BGP compares the AS_Path attribute values. If the
AS_Path attribute values are the same, BGP compares the AS numbers.

Page 61 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Summary
• BGP selects optimal routes based on path attributes. This allows BGP to select optimal routes
based on path attributes in different scenarios.
• BGP defines a set of detailed optimal path selection algorithms, which enable routers to select
the optimal path in any complex and highly redundant network environment.
• BGP route selection rules are frequently used in practice and need to be mastered.

Page 62 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
谢谢
Thank You
www.huawei.com

Page 63 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.

You might also like