cs 672 1 summer 2003 lecture 3. cs 672 2 summer 2003 what is a bgp path attribute? bgp uses a set of...
Post on 20-Dec-2015
221 views
TRANSCRIPT
CS 672
1
Summer 2003
Lecture 3
CS 672
2
Summer 2003
What is a BGP Path Attribute?
• BGP uses a set of parameters known as path attributes to characterize a route.
• BGP path attributes are similar in nature to the IGP metrics.• BGP Update message contains variable number of path attributes.
CS 672
3
Summer 2003
BGP Path Attributes
1 Origin Well-known, mandatory
2 AS_Path Well-known, mandatory
3 Next_Hop Well-known, mandatory
4 Multi_Exit_Disc (MED) Optional non-transitive
5 Local_Pref Well-known, discretionary
6 Atomic_Aggregate Well-known, discretionary
7 Aggregator Optional, transitive
8 Community Optional, transitive)
… … …
Attribute NameAttribute Type Code Category
CS 672
4
Summer 2003
BGP Path Attributes (Well-known)
• Each Path Attribute belongs to one of following four categories:• Well-known Mandatory
Attribute is recognized by all BGP implementations Included in each Update message
• Well-known Discretionary Attribute is recognized by all BGP implementations It may or may not be present in an Update message
CS 672
5
Summer 2003
BGP Path Attributes (Optional)
• Well-known attributes are always transitive (i.e., to be propagated to peers). The Optional attributes can be transitive or non-transitive.
• Optional Transitive Attribute is not recognized by all BGP implementations It may or may not be present in an Update message If present and transitive flag is set, the receiving BGP speaker should pass it on to other peers
• Optional Non-transitive Attribute is not recognized by all BGP implementations It may or may not be present in an Update message If present and the non-transitive flag is set, the BGP speaker should NOT pass it on to other peers
CS 672
6
Summer 2003
Path Attributes Encoding
• Each Path Attribute is encoded as a triple <type(T), length(L),value(V)> or TLV format.
• Attribute Type field (2 byte)• Contains subfields (1 byte each) namely Attribute Flags and Attribute Type Code• The attribute Flags field is used for categorization of the attribute (e.g., Well-known
Mandatory, Well-known Discretionary, …)• The attribute type code value is used to identify a particular Path Attribute (e.g., type
code = 1 means Origin, type code = 2 means AS_Path, …)
CS 672
7
Summer 2003
Path Attribute Encoding
b0 = 0 means Well-known attribute b0 = 1 means Optional attributed b1 = 0 means the Optional attribute is non-transitive b1 = 1 means the Optional attribute is transitive
Attribute Flags
Attribute Type Codeb0 b1 b2 b3 Unused bits
1. Origin (Attribute Type Code =1)2. AS_Path (Attribute Type Code = 2)3. Next_Hop (Attribute Type Code = 3)…
CS 672
8
Summer 2003
Routing Information Bases (RIBs)
• BGP stores its routes in RIB. BGP routing information bases can be further categorized as:• Adj-RIBs-In
Stores the routes learned via Update messages from peers• Adj-RIBs-Out
Stores the routes selected for advertisement to peers• Loc-RIB
Stores routes that have been selected by the decision process• BGP keeps its forwarding state in forwarding information base (FIB).
• FIB is the routing information that is used for forwarding.
CS 672
9
Summer 2003
BGP Decision Process
• BGP takes Adj-RIBs-In as input and carries out a three phase decision function for selecting and advertising the best routes.• Phase I: determine a degree of preference (e.g., using Local_Pref path attribute or
preconfigured local policy) for each route learned from neighbors• Phase II: select the best route out of all available routes for each destination and
install it in the Loc-Rib. All routes with unfeasible BGP next hop addresses (i.e., Next_Hop address) are excluded from the second phase decision function.
• Phase III: take Loc-RIB as input, processes it (e.g., filter, manipulate path attributes) to influence routing behavior, generate a corresponding entry in the Adj-RIBs-Out.
CS 672
10
Summer 2003
Adj-RIBs-Out
Adj-RIBs-In
Input filtering and Pathattribute manipulation
Output filtering and Pathattribute manipulation
Decision Process
Loc-RIB
FIB
Locally originated routes
Adj-RIBs-In
Loc-RIB
FIB
Adj-RIBs-Out
Input filtering and Pathattribute manipulation
Output filtering and Pathattribute manipulation
Decision Process
Locally originated routes
Advertise routes via Update message
Advertise routes via Update message
BGP Speaker 1 BGP Speaker 2
BGP Peers
CS 672
11
Summer 2003
AS100AS200
eBGP
IGP Static Routes
BGP
IGP
BGP
IGP/static routesinjected into BGP
Update (NLRI, attributes)
CS 672
12
Summer 2003
BGP Route Selection
• BGP uses path attributes to select best routes and influence decision process of peers. The selection of a most preferable route is performed as follows:1. From the routes available in Adj-RIBs-In, exclude routes with inaccessible next hop address.2. Select the routes with largest local preference.3. If local preference is same, select a locally (by the router) originated route.4. If still multiple candidates, select the route with the shortest AS_Path.5. If the AS_Path is same, select the route with lowest value of origin type (0=IGP, 1=EGP,
2=Incomplete).6. If origin type same, select the route with lowest MED.7. …..
CS 672
13
Summer 2003
Origin Attribute
• Origin (Attribute Type Code = 1) is a Well-Known path attribute that defines the origin of the routing information contained in the Update message.• Origin attribute is created by the AS that originates routing information (i.e., NLRI)• The receiving speakers pass along the Origin parameter in their UPDATE messages when
advertising corresponding routing information to other speakers.• BGP considers following origin types:
• (0=)IGP - Network Layer Reachability Information (NLRI) is internal to the originating AS• (1=)EGP - NLRI is learned via EGP (e.g., BGP) in the originating AS• (2=)INCOMPLETE – NLRI is learned by some other means in the originating AS.
CS 672
14
Summer 2003
Update (NLRI=128.32.0.0, Origin = IGP)2
R1R2
R3
128.32.0.0eBGP
eBGP
1
3Update (NLRI=128.32.0.0, Origin = IGP)
1 R1 learns about prefix (128.32.0.0) via IGP
2 R1 originates this route with Origin attribute set to IGP
3 After going through BGP decision process, R2 decides to advertise this route to its eBGP peer R3. R2 propagates the Origin attribute associated with the NLRI to R3.
CS 672
15
Summer 2003
AS_Path Attribute
• AS_Path attribute is a Well-known mandatory attribute• AS_Path attribute identifies the AS’s traversed by the NLRI contained in the Update message• The traversed AS’s are recorded in two ways:
• Ordered sequence of AS numbers (i.e., AS_Sequence list), or• Unordered sequence of AS numbers (i.e., AS_Set list)
• When an iBGP speaker originates a route, it includes an empty AS_Path attribute list.• A BGP speaker includes its AS number in the AS_Path attribute when advertising or originating a
route to an eBGP peer.• When a BGP speaker advertises a route received from an eBGP peer to an iBGP peer, it does not
modify the AS_Path attribute.
CS 672
16
Summer 2003
1 R6 originates a BGP route for 179.16.12.0/24 with empty AS_Path
2 R4 advertises this route for 179.16.12.0/24 with AS_Path = 200
3 R3 advertises this route to R1 with AS_Path = 200
4 R1 advertises this route to R7 with AS_Path = 300, 200.
AS 300
AS 200
R1
R2
R3
R4
R6
R5
iBGP
eBGP
iBGP
R7
eBGP
2
1
3
4
CS 672
17
Summer 2003
AS_Path Attribute
• BGP uses AS_Path attribute to construct a loop-free AS topology graph.• For instance, BGP does not accept an Update message if its own AS number is included in the
AS_Path attribute.• BGP also uses the AS_Path attribute in its decision process for selecting a best route.
• For example, when there are several routes to chose from, BGP selects the route with the shortest AS_Path attribute.
• AS_Path attribute is also used identify routes for applying input/output route filtering.• In summary, manipulation of AS_Path attribute enable BGP to influence certain inter-
AS routing behavior.
CS 672
18
Summer 2003
AS 100
AS 200
AS 300
172.64.16.0/16
1 Update (172.64..16.0/16, AS_Path = {AS100})
Update (172.64..16.0/16, A
S_P
ath = {A
S100, A
S200})
1
Update (172.64..16.0/16, AS_Path = {AS100, AS200, AS300})3
4 AS100rejects this Update message
CS 672
19
Summer 2003
AS_Path and Routing Behavior
• We know that in case of a tie, a route with shorter AS_Path length is preferred.
• Thus AS_Path attribute can be used to influence inter-AS routing behavior.
• For example, BGP speaker can insert dummy AS numbers in the AS_Path attribute to increase its length to make it less preferable during the BGP decision process.
CS 672
20
Summer 2003
Update (NLRI= 172.64.16.0/16,AS_Path{AS100,AS200})
AS 100
AS 200
AS 300
AS 500
DS3
DS3
OC3 ( 155 Mb/s)
OC3
AS 400
OC3
172.64.16.0/16
Update
(NLRI=
172.6
4.16.0
/16,
AS_Path
{AS10
0,AS30
0, As4
00}}
)
Traffic flow
CS 672
21
Summer 2003
Update (NLRI= 172.64.16.0/16,AS_Path{AS100,AS100,AS100,AS00,AS200})
AS 100
AS 200
AS 300
AS 500
DS3
DS3
OC3 ( 155 Mb/s)
OC3
AS 400
OC3
172.64.16.0/16
AS100 inserts dummy AS numbers
Update
(NLRI=
172.6
4.16.0
/16,
AS_Path
{AS10
0,AS30
0, As4
00}}
)
Update (NLRI= 172.64.16.0/16,AS_Path{AS100,AS100, AS100})
Traffic Flow