0% found this document useful (0 votes)
34 views

d1 s2 BGP Path Attributes and Best Path Selection

The document discusses BGP path attributes and best path selection. It describes several key BGP path attributes like AS_PATH, NEXT_HOP, LOCAL_PREF, and WEIGHT. It also compares the best path selection process of Cisco IOS, Juniper Junos, and MikroTik RouterOS.

Uploaded by

bong
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views

d1 s2 BGP Path Attributes and Best Path Selection

The document discusses BGP path attributes and best path selection. It describes several key BGP path attributes like AS_PATH, NEXT_HOP, LOCAL_PREF, and WEIGHT. It also compares the best path selection process of Cisco IOS, Juniper Junos, and MikroTik RouterOS.

Uploaded by

bong
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 27

Border Gateway Protocol (BGP)

BGP Path Attributes & Best Path


Selection

1 v1.2
BGP Path Attributes & Best Path Selection

BGP Path Attribute Categories

2 v1.2
BGP Path Attribute Categories
• There are four categories of path attribute:
– Well-known Mandatory
• This attribute must exist in BGP UPDATE
• If missing, a NOTIFICATION is generated and the session is terminated
– Well-known Discretionary
• This attribute must be recognized by all BGP implementations, but does not have to be
included in every BGP UPDATE
– Optional Transitive
• If the attribute is not recognized by the BGP implementation, the attribute should be
accepted and passed along to other peers
– Optional Non-transitive
• If the attribute is not recognized by the BGP implementation, the attribute should be
ignored and not passed on to other peers

3 v1.2
BGP Path Attribute Categories
BGP Path Attributes

Well-known Optional

Mandatory Discretionary Transitive Non-Transitive

AS_PATH LOCAL_PREF AGGREGATOR MULTI_EXIT_DISC


(RFC4271) (RFC4271) (RFC4271) (RFC4271)

NEXT_HOP ATOMIC_AGGREGATE COMMUNITIES ORIGINATOR_ID


(RFC4271) (RFC4271) (RFC1997) (RFC4456)

ORIGIN CLUSTER_LIST
(RFC4271) (RFC4456)

4 v1.2
BGP Path Attributes & Best Path Selection

BGP Best Path Selection

5 v1.2
BGP Best Path Selection
Step Cisco IOS Juniper Junos MikroTik RouterOS
1 Highest WEIGHT NEXT_HOP can be resolved NEXT_HOP is reachable
2 Highest LOCAL_PREF Lowest Route Preference value Prefer the first path received
3 Prefer locally originated path Highest LOCAL_PREF Highest WEIGHT
4 Shortest AS_PATH Lowest AIGP attribute Highest LOCAL_PREF
5 Lowest ORIGIN Shortest AS_PATH Shortest AS_PATH
6 Lowest MULTI_EXIT_DISC Lowest ORIGIN Prefer locally originated path
7 Prefer EBGP path over IBGP path Lowest MULTI_EXIT_DISC Lowest ORIGIN
8 Lowest IGP metric to NEXT_HOP Prefer locally originated path Lowest MULTI_EXIT_DISC
9 Continue if Multipath is not enabled Prefer EBGP path over IBGP path Prefer EBGP path over IBGP path
10 If paths are external, prefer the older one Lowest IGP metric to NEXT_HOP Lowest Router ID
11 Lowest Router ID If paths are external, prefer the active one Shortest CLUSTER_LIST
12 Shortest CLUSTER_LIST Prefer primary route over secondary route Lowest peer address
13 Lowest peer address Lowest Router ID
14 Shortest CLUSTER_LIST
15 Lowest peer address

6 v1.2
BGP Best Path Selection
• Reference:
– Cisco IOS
• https://www.cisco.com/c/en/us/support/docs/ip/border-gateway-protocol-bgp/13753-
25.html
– Juniper Junos
• https://www.juniper.net/documentation/en_US/junos/topics/reference/general/routing-
protocols-address-representation.html
– MikroTik RouterOS
• https://wiki.mikrotik.com/wiki/Manual:BGP_Best_Path_Selection_Algorithm

7 v1.2
BGP Path Attributes & Best Path Selection

BGP Path Attributes

8 v1.2
Weight (WEIGHT)
• WEIGHT indicates the preference Global Internet
level of specific path in current router.
– Default value: 0 AS65000 AS65001
– Can be set by inbound routing policy R101 R201

• Cisco proprietary attribute. Internet Internet


prefix: prefix:
– Also implemented in MikroTik RouterOS 1.1.1.0/24 1.1.1.0/24

• Only significant within local router. 1.1.1.0/24


AS64512 1.1.1.0/24
– Not included in BGP advertisement Set Weight: 100 Set Weight: 200

• Best path selection: Higher WEIGHT R1


is preferred.
R1’s best path for 1.1.1.0/24 is via AS65001
9 v1.2
Next Hop (NEXT_HOP)
• IP address that is used to reach a certain destination.
– For EBGP, NEXT_HOP is router’s local peer address
– NEXT_HOP advertised by EBGP is carried into IBGP

• Best path selection: NEXT_HOP must be reachable.

AS65000
Loopback: Loopback:
10.0.0.1 10.0.0.2

.1 172.20.0.0/30 .2
AS64512
172.18.1.0/24

172.18.1.0/24 172.18.1.0/24
R101 R1 R2
NEXT_HOP: 172.20.0.1 NEXT_HOP: 172.20.0.1

10 v1.2
Next Hop Self
• Forces the router to set its local peer address as NEXT_HOP
of the prefixes advertised to IBGP peers.
• Used when point-to-point link between EBGP peers
(172.20.0.0/30) is not advertised into IGP.
Next Hop Self
Configured

AS65000
Loopback: Loopback:
10.0.0.1 10.0.0.2

.1 172.20.0.0/30 .2
AS64512
172.18.1.0/24

172.18.1.0/24 172.18.1.0/24
R101 R1 R2
NEXT_HOP: 172.20.0.1 NEXT_HOP:
172.20.0.1 à 10.0.0.1
11 v1.2
Local Preference (LOCAL_PREF)
• LOCAL_PREF indicates the Global Internet

preference level of the path to exit


the AS. AS65000 AS65001

– Default value: 100 R101 R201

– Can be set by routing policy Internet Internet


prefix: prefix:
1.1.1.0/24 1.1.1.0/24
• Only significant within local AS.
– This attribute is not advertised in EBGP R1 R2
AS64512
• Best path selection: Higher 1.1.1.0/24
Set LOCAL_PREF: 100
1.1.1.0/24
Set LOCAL_PREF: 200

LOCAL_PREF is preferred.
AS64512’s best path for 1.1.1.0/24 is via AS65001
12 v1.2
AS Path (AS_PATH)
• List of ASNs that an update has traversed.
• Can be manipulated for traffic engineering.
– AS Path Prepending in outbound routing policy

• Best path selection: Shorter AS Path is preferred.

AS65000 AS65001
Loopback: Loopback:
10.0.0.1 10.0.0.2

.1 172.20.0.0/30 .2
AS64512 .1 172.28.0.0/30 .2
172.18.1.0/24

172.18.1.0/24 172.18.1.0/24 172.18.1.0/24


R101 R1 R2 R201
AS_PATH: 65000 AS_PATH: 65000 AS_PATH: 64512 65000

13 v1.2
Origin (ORIGIN)
• Information about how a prefix is originated into BGP.
– IGP
• Prefix is fed into BGP by the network command
– EGP
• Prefix is learned via Exterior Gateway Protocol (now obsolete)
– Incomplete
• Origin is unknown
• Prefix is a result of aggregation
• Occurs when prefix is redistributed from other protocols into BGP

• Best path selection: Lower ORIGIN


– IGP < EGP < Incomplete
14 v1.2
MED (MULTI_EXIT_DISC)
• Multi Exit Discriminator (MED or MULTI_EXIT_DISC) is a hint
to external peer about path preference into an AS.
– Exchanged between directly peered ASes, not passed to the third AS
– Ignored if received from different ASes
– Default value: 0
– Can be set by routing policy

• IGP metric is copied to MED when redistributed into BGP.


• Best path selection: Lower MED is preferred.

15 v1.2
MED Example
• AS64512
– R1 originates 10.2.1.0/24 and advertises AS65002
• to R2 (IBGP)
• to AS65000 (EBGP)
– MED is not set AS65000 AS65001
• to AS65001 (EBGP)
R101 R201
– Set MED: 50

– R2 re-advertises 10.2.1.0/24 2 4
. /
0 50
1
• to AS65001 (EBGP) 10.2.1.0/24 .2
10 ME
. D: 10.2.1.0/24
MED not set e t Set MED: 100
– Set MED: 100 S
10.2.1.0/24
R1 R2
AS64512
10.2.1.0/24

16 v1.2
MED Example
• AS65000
– R101 re-advertises 10.2.1.0/24 AS65002
• to AS65001 (EBGP)
– Set MED: 10 10.2.1.0/24 10.2.1.0/24
– By default, MED is not advertised to the third AS if not set No MED No MED
• to AS65002 (EBGP) AS65000 AS65001
10.2.1.0/24
– MED is not advertised to the third AS Set MED: 10
R101 R201

• AS65001 10.2.1.0/24
No MED
2 4
– R201 re-advertises 10.2.1.0/24 10.2.1.0/24 .2 1 .
. D:
/
0 50
10.2.1.0/24
10 ME
• to AS65000 (EBGP) MED not set
S e t Set MED: 100

– MED is not advertised to the third AS 10.2.1.0/24


R1 R2
• to AS65002 (EBGP) AS64512
– MED is not advertised to the third AS
10.2.1.0/24

17 v1.2
MED Example
• Prefix 10.2.1.0/24
– R1, R2 and R101 advertised the same AS65002
prefix to R201 with different MED values
10.2.1.0/24 10.2.1.0/24
• R1 set MED to 50 No MED No MED
• R2 set MED to 100 AS65000 AS65001
10.2.1.0/24
Set MED: 10
• R101 set MED to 10
R101 R201
– R201 compares only MEDs from the 10.2.1.0/24
No MED
same AS (R1 and R2), MED from 1 .
. D:
/2
0 50
4
10.2.1.0/24 .2 10.2.1.0/24
different AS (R101) is ignored MED not set 10 ME
S e t Set MED: 100
10.2.1.0/24
– MED is not re-advertised to the third AS R1 R2
AS64512
10.2.1.0/24

Best path from R201 to 10.2.1.0/24 is via R1


18 v1.2
Communities
• Attribute that groups prefixes for informational purpose or
action for implementing specific routing policies.
– Standard Community (32-bit or 4-byte)
• RFC1997: BGP Communities Attribute
– Extended Community (64-bit or 8-byte)
• RFC4360: BGP Extended Communities Attribute
– Large Community (96-bit or 12-byte)
• RFC8092: BGP Large Communities Attribute

• Further action can be taken to the whole group of prefixes by


matching the Community values.

19 v1.2
Standard Community (COMMUNITIES)
• 32-bit value
– Value range: 0x00000000 – 0xFFFFFFFF
– Reserved values: 0xFFFF0000 – 0xFFFFFFFF

• Can be expressed as:


– A single 32-bit decimal number
• Referred as “Old Format” in Cisco IOS
– Two 16-bit decimal numbers separated by a colon (XX:YY)
• Referred as “New Format” in Cisco IOS
• “XX” part is commonly used for embedding own ASN
• “YY” part is defined for signaling a specific information or action

20 v1.2
Well-known Communities
• NO_EXPORT
– Value: 0xFFFFFF01
• Old Format: 4294967041
• New Format: 65535:65281
– Must not be advertised outside a BGP Confederation boundary
– A stand-alone AS that is not part of a Confederation is considered a
Confederation itself

21 v1.2
Well-known Communities
• NO_ADVERTISE
– Value: 0xFFFFFF02
• Old Format: 4294967042
• New Format: 65535:65282
– Must not be advertised to any BGP peer

22 v1.2
Well-known Communities
• NO_EXPORT_SUBCONFED
– Value: 0xFFFFFF03
• Old Format: 4294967043
• New Format: 65535:65283
– Must not be advertised to any EBGP peer, including peers from other
member ASes inside a BGP Confederation
– Also known as “local-AS”

23 v1.2
Well-known Communities
• NOPEER
– Value: 0xFFFFFF04
• Old Format: 4294967044
• New Format: 65535:65284
– Should not be advertised to external bilateral peer neighbor ASes
– RFC3765: NOPEER Community for Border Gateway Protocol (BGP)
Route Scope Control

24 v1.2
Standard Communities for AS64512
• Informational
– Relationship
• 64512:100 = Customer prefixes
• 64512:200 = Prefixes from private peering or Internet eXchange (IX)
• 64512:300 = Internet prefixes from upstream provider
– Geographic location
• 64512:1000 = Prefixes received from Asia
• 64512:2000 = Prefixes received from Europe
• 64512:3000 = Prefixes received from North America
• 64512:4000 = Prefixes received from South America
• 64512:5000 = Prefixes received from Africa

25 v1.2
Standard Communities for AS64512
• Action
– Access Control
• 64512:666 = Blackhole routes, drop traffic to these destinations
– Traffic Engineering
• 64512:901 = Prepend 1x when advertising to other ASes
• 64512:902 = Prepend 2x when advertising to other ASes
• 64512:903 = Prepend 3x when advertising to other ASes
• 64512:920 = Do not advertise to any Peer
• 64512:930 = Do not advertise to any Transit Provider

26 v1.2
Standard Community Example
R3

10.2.3.0/24
10.2.3.0/24
COMMUNITIES:
AS65000 NO_EXPORT

.1 172.20.0.0/30 .2
AS64512
10.2.2.0/24

10.2.2.0/24 10.2.2.0/24
R101 R1 R2
AS_PATH: 64512 64512 64512 COMMUNITIES:
(10.2.3.0/24 is not advertised) 64512:902

• “64512:902” signals R1 to prepend 2x of own ASN.


– Relevant routing policies need to be configured on R1
• If a prefix is tagged with “64512:902”, then prepend AS “64512 64512” additionally
– “NO_EXPORT” instructs R1 not to advertise 10.2.3.0/24 to its EBGP
peer R101 from AS65000.
27 v1.2

You might also like