FT-BGP

Cours BGP-MPLS-IPV6-QOS
France Telecom
Introduction to BGP
© 2005 Cisco Systems, Inc. All rights reserved.
BGP v3.2—1-1
Outline
• Reviewing Routing Operations (1-3)
• Interdomain Routing (1-9)
• BGP Characteristics (1-13)
• Single-Homed and Multihomed Customers (1-18)
• Selecting a BGP Path (1-25)
• Working with a Transit AS (1-39)
• Interacting with IBGP and EBGP in a Transit AS (1-46)
• Processing BGP Routes (1-61)
© 2005 Cisco Systems, Inc. All rights reserved.
BGP v3.2—1-2
Reviewing Routing Operations
© 2005 Cisco Systems, Inc. All rights reserved.
BGP v3.2—1-3
Static vs. Dynamic Routes
Static Route
• Uses a route that a
network administrator
enters into the router
manually
© 2005 Cisco Systems, Inc. All rights reserved.
Dynamic Route
• Uses a route that a
network routing protocol
adjusts automatically for
topology or traffic
changes
BGP v3.2—1-4
What Is a Dynamic Routing Protocol?
 Routing protocols are
used between routers to
determine paths to remote
networks and maintain
those networks in the
routing tables.
 After the path is determined,
a router can route a routed
protocol to the learned
networks
© 2005 Cisco Systems, Inc. All rights reserved.
BGP v3.2—1-5
Autonomous Systems: IGP and EGP
 An autonomous system is a collection of networks within
a common administrative domain.
 Interior gateway protocols operate within an autonomous system.
 Exterior gateway protocols connect different autonomous systems.
© 2005 Cisco Systems, Inc. All rights reserved.
BGP v3.2—1-6
Classes of Routing Protocols
© 2005 Cisco Systems, Inc. All rights reserved.
BGP v3.2—1-7
Selecting the Best Route Using Metrics
© 2005 Cisco Systems, Inc. All rights reserved.
BGP v3.2—1-8
Interdomain routing
© 2005 Cisco Systems, Inc. All rights reserved.
BGP v3.2—1-9
Interdomain Routing
• An AS is a collection of networks under a single technical
administration.
• An IGP is run inside an AS, resulting in optimum intra-AS
routing.
• An EGP is run between autonomous systems to enable
routing policies and improve security.
© 2005 Cisco Systems, Inc. All rights reserved.
BGP v3.2—1-10
Design Goals for Interdomain Routing
Scalability
• The Internet has more than 300,000 routes and is still
growing.
Secure routing information exchange
• Routers from another AS cannot be trusted.
• Tight filters are required; authentication is desirable.
Support for routing policies
• Routing between autonomous systems might not always
follow the optimum path.
© 2005 Cisco Systems, Inc. All rights reserved.
BGP v3.2—1-11
Why External Routing Protocols?
Q: Assuming standard IGP route selection rules, how will the
traffic between AS 1 and AS 20 flow?
Q: Will AS 2 allow this traffic?
Q: How would you solve this problem with OSPF or EIGRP?
© 2005 Cisco Systems, Inc. All rights reserved.
BGP v3.2—1-12
BGP characteristics
© 2005 Cisco Systems, Inc. All rights reserved.
BGP v3.2—1-13
BGP Characteristics
BGP is a distance vector protocol with
enhancements:
• Reliable updates
• Triggered updates only
• Rich metrics (1-called path attributes)
Designed to scale to huge internetworks
© 2005 Cisco Systems, Inc. All rights reserved.
BGP v3.2—1-14
BGP Characteristics (1-Cont.)
Reliable updates
•
•
•
•
TCP 179 used as transport protocol
No periodic updates
Periodic keepalives to verify TCP connectivity
Triggered updates batched and rate-limited
– Every 5 seconds for internal peer
– Every 30 seconds for external peer
© 2005 Cisco Systems, Inc. All rights reserved.
BGP v3.2—1-15
BGP Characteristics (1-Cont.)
Protocol development considerations
• BGP was designed to perform well in the following areas:
– Interdomain routing applications
– Huge internetworks with large routing tables
– Environments that require complex routing policies
• Some design tradeoffs were made:
– BGP uses TCP for reliable transport—
CPU-intensive
– Scalability is the top priority—slower convergence
© 2005 Cisco Systems, Inc. All rights reserved.
BGP v3.2—1-16
BGP Characteristics (1-Cont.)
Common BGP uses
• Customers connected to more than one service provider
• Service provider networks (1-transit autonomous systems)
• Service providers exchanging traffic at an exchange point (1CIX, GIX, NAP, …)
• Network cores of large-enterprise customers
© 2005 Cisco Systems, Inc. All rights reserved.
BGP v3.2—1-17
Single-Homed and Multi-Homed Customers
© 2005 Cisco Systems, Inc. All rights reserved.
BGP v3.2—1-18
Single-Homed Customers
Large customer or small ISP connecting to the Internet
© 2005 Cisco Systems, Inc. All rights reserved.
BGP v3.2—1-19
Use Guidelines―Single-Homed Customers
Use BGP between the customer and the service
provider in these situations:
• Customers multihomed to the same service provider
• Customers that need dynamic routing protocol with the
service provider to detect failures
– Hint: Use private AS number for these customers.
• Smaller ISPs that need to originate their routes in the Internet
Use static routes in all other cases:
• Static routes always simpler than BGP
© 2005 Cisco Systems, Inc. All rights reserved.
BGP v3.2—1-20
Multihomed Customers
Customer connecting to more than one service provider
© 2005 Cisco Systems, Inc. All rights reserved.
BGP v3.2—1-21
User Guidelines―Multihomed Customers
• BGP is almost mandatory for multihomed customers.
• Multihomed customers have to use public AS numbers.
• Multihomed customers should use a provider-independent
address space.
© 2005 Cisco Systems, Inc. All rights reserved.
BGP v3.2—1-22
Transit Autonomous Systems
Using BGP to exchange routes is mandatory for transit
autonomous systems (1-provider networks carrying customer
traffic).
© 2005 Cisco Systems, Inc. All rights reserved.
BGP v3.2—1-23
BGP Limitations
BGP and associated tools cannot express all routing
policies.
• You cannot influence the routing policies of downstream
autonomous systems.
“BGP does not enable one AS to send traffic
to a neighbor AS intending that the traffic
take a different route from that taken by traffic
originating in the neighbor AS.”
RFC 1771
© 2005 Cisco Systems, Inc. All rights reserved.
BGP v3.2—1-24
Selecting a BGP Path
© 2005 Cisco Systems, Inc. All rights reserved.
BGP v3.2—1-25
BGP Path Attributes
• BGP metrics are called path attributes.
• Characteristics of path attributes include:
– Well-known versus optional
– Mandatory versus discretionary
– Transitive versus nontransitive
– Partial
© 2005 Cisco Systems, Inc. All rights reserved.
BGP v3.2—1-26
Well-Known Attributes
• Well-known attributes
– Must be recognized by all compliant BGP implementations
– Are propagated to other neighbors
• Well-known mandatory attributes
– Must be present in all update messages
• Well-known discretionary attributes
– May be present in update messages
© 2005 Cisco Systems, Inc. All rights reserved.
BGP v3.2—1-27
Optional Attributes
• Optional attributes
– They are recognized by some implementations (1-could be
private); but expected not to be recognized by all BGP
routers.
– Recognized optional attributes are propagated to other
neighbors based on their meaning.
• Optional transitive attributes
– If not recognized, marked as partial and propagated to
other neighbors
• Optional nontransitive attributes
– Discarded if not recognized
© 2005 Cisco Systems, Inc. All rights reserved.
BGP v3.2—1-28
BGP Attributes
BGP attributes include the following:
• AS path *
• Next-hop *
• Origin *
• Local preference
• MED
• Others
* Well-known mandatory attribute
© 2005 Cisco Systems, Inc. All rights reserved.
BGP v3.2—1-29
AS Path Attribute
• A list of autonomous
systems that a route has
traversed:
– For example, on router
B, the path to 192.168.1.0
is the AS sequence
(1-65500, 64520).
• The AS path attribute is
well-known, mandatory.
© 2005 Cisco Systems, Inc. All rights reserved.
BGP v3.2—1-30
Next-Hop Attribute
The IP address of the
next AS to reach a given
network:
• Router A advertises
network 172.16.0.0 to
router B in EBGP, with a
next hop of 10.10.10.3.
• Router B advertises
172.16.0.0 in IBGP to
router C, keeping 10.10.10.3
as the next-hop address.
The next-hop attribute is
well-known, mandatory.
© 2005 Cisco Systems, Inc. All rights reserved.
BGP v3.2—1-31
Origin Attribute
• IGP (1-i)
– network command
• EGP (1-e)
– Redistributed from EGP
• Incomplete (1-?)
– Redistributed from IGP or static
The origin attribute informs all autonomous systems
in the internetwork how the prefixes were
introduced into BGP.
The origin attribute is well-known, mandatory.
© 2005 Cisco Systems, Inc. All rights reserved.
BGP v3.2—1-32
Example: Origin Attribute
RouterA# show ip bgp
BGP table version is 14, local router ID is 172.31.11.1
Status codes: s suppressed, d damped, h history, * valid, > best, i internal, r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Network
Next Hop
Metric LocPrf Weight Path
*> 10.1.0.0/24
0.0.0.0
0
32768 i
* i
10.1.0.2
0
100
0 i
*> 10.1.1.0/24
0.0.0.0
0
32768 i
*>i10.1.2.0/24
10.1.0.2
0
100
0 i
*> 10.97.97.0/24
172.31.1.3
0 64998 64997
*
172.31.11.4
0 64999 64997
* i
172.31.11.4
0
100
0 64999 64997
*> 10.254.0.0/24
172.31.1.3
0
0 64998 i
*
172.31.11.4
0 64999 64998
* i
172.31.1.3
0
100
0 64998 i
r> 172.31.1.0/24
172.31.1.3
0
0 64998 i
r
172.31.11.4
0 64999 64998
r i
172.31.1.3
0
100
0 64998 i
*> 172.31.2.0/24
172.31.1.3
0
0 64998 i
<output omitted>
© 2005 Cisco Systems, Inc. All rights reserved.
i
i
i
i
i
BGP v3.2—1-33
Local Preference Attribute
Paths with highest local preference value are preferred:
• Local preference is used to advertise to IBGP neighbors about how to leave their AS.
• The local preference is sent to IBGP neighbors only (1-that is, within the AS only).
• The local preference attribute is well-known and discretionary.
• Default value is 100.
© 2005 Cisco Systems, Inc. All rights reserved.
BGP v3.2—1-34
MED Attribute
• The paths with the lowest MED (1also called the metric) value are
the most desirable:
– MED is used to advertise
to EBGP neighbors
how to exit their
AS to reach networks owned
by this AS.
• The MED attribute is optional and
nontransitive.
© 2005 Cisco Systems, Inc. All rights reserved.
BGP v3.2—1-35
Weight Attribute (1-Cisco Only)
Paths with the highest weight value are preferred
• Weight not sent to any BGP neighbors; local to this
router only
© 2005 Cisco Systems, Inc. All rights reserved.
BGP v3.2—1-36
BGP Path Selection
• The BGP forwarding table usually has multiple paths from
which to choose for each network.
• BGP is not designed to perform load balancing:
– Paths are chosen because of policy.
– Paths are not chosen based on bandwidth.
• The BGP selection process eliminates any multiple paths
through attrition until a single best path is left.
• That best path is submitted to the routing table manager
process and evaluated against the methods of other routing
protocols for reaching that network (1-using administrative
distance).
• The route from the source with the lowest administrative
distance is installed in the routing table.
© 2005 Cisco Systems, Inc. All rights reserved.
BGP v3.2—1-37
Route Selection Decision Process
Consider only (1-synchronized) routes with no AS loops
and a valid next hop, and then:
1.
2.
Prefer highest weight (1-local to router).
Prefer highest local preference (1-global within AS).
3.
4.
5.
6.
Prefer route originated by the local router (1-next hop = 0.0.0.0).
Prefer shortest AS path.
Prefer lowest origin code (1-IGP < EGP < incomplete).
Prefer lowest MED (1-exchanged between autonomous systems).
7.
8.
9.
Prefer EBGP path over IBGP path.
Prefer the path through the closest IGP neighbor.
Prefer oldest route for EBGP paths.
10. Prefer the path with the lowest neighbor BGP router ID.
11. Prefer the path with the lowest neighbor IP address.
© 2005 Cisco Systems, Inc. All rights reserved.
BGP v3.2—1-38
Working with a transit AS
© 2005 Cisco Systems, Inc. All rights reserved.
BGP v3.2—1-39
Working with a Transit AS
• Overview
• Transit AS Tasks
• External Route Propagation
• Internal Route Propagation
• Packet Forwarding in an AS
• Core Router IBGP Requirements in a Transit AS
© 2005 Cisco Systems, Inc. All rights reserved.
BGP v3.2—1-40
Transit AS Tasks
• Propagate routes between remote autonomous systems
• Route packets between remote networks
© 2005 Cisco Systems, Inc. All rights reserved.
BGP v3.2—1-41
External Route Propagation
© 2005 Cisco Systems, Inc. All rights reserved.
BGP v3.2—1-42
Internal Route Propagation
© 2005 Cisco Systems, Inc. All rights reserved.
BGP v3.2—1-43
Packet Forwarding in an AS
© 2005 Cisco Systems, Inc. All rights reserved.
BGP v3.2—1-44
Core Router IBGP Requirements in a
Transit AS
• All core routers must have all external routes.
• Core routers must receive BGP routes.
– Redistribution of BGP routes into IGP is not scalable.
– Default routing is not applicable in transit
AS core.
© 2005 Cisco Systems, Inc. All rights reserved.
BGP v3.2—1-45
BGP Transit Autonomous Systems
Interacting with IBGP and EBGP in a Transit AS
© 2005 Cisco Systems, Inc. All rights reserved.
BGP v3.2—1-46
Outline
• Overview
• AS-Path Processing in IBGP
• Multipath Load Sharing in BGP
• BGP Split Horizon
• IBGP Full Mesh
• IBGP Neighbors
• IBGP Next-Hop Processing
• Transit Network Using External Next Hops
• Transit Network Using Edge Routers as Next Hops
• Differences Between EBGP and IBGP Sessions
• Summary
© 2005 Cisco Systems, Inc. All rights reserved.
BGP v3.2—1-47
AS-Path Processing in IBGP
© 2005 Cisco Systems, Inc. All rights reserved.
BGP v3.2—1-48
Multipath Load Sharing in BGP
© 2005 Cisco Systems, Inc. All rights reserved.
BGP v3.2—1-49
BGP Split Horizon
Result: Full mesh of IBGP sessions is required for proper
IBGP update propagation.
© 2005 Cisco Systems, Inc. All rights reserved.
BGP v3.2—1-50
IBGP Full Mesh
• Full mesh of IBGP sessions has to be established between all BGP-speaking
routers in the AS for proper IBGP route propagation.
• The IBGP full mesh is a logical mesh of TCP sessions only; physical full mesh
is not required.
© 2005 Cisco Systems, Inc. All rights reserved.
BGP v3.2—1-51
IBGP Full Mesh Example
© 2005 Cisco Systems, Inc. All rights reserved.
BGP v3.2—1-52
IBGP Neighbors
• Because of IBGP full-mesh requirements, IBGP neighbors are
usually not directly connected.
• Which interfaces should be chosen as the source and
destination addresses of IBGP TCP sessions?
© 2005 Cisco Systems, Inc. All rights reserved.
BGP v3.2—1-53
IBGP Neighbors (1-Cont.)
Always run IBGP sessions between loopback
interfaces.
• IBGP sessions can always be established, even if some
physical interfaces are down.
• IBGP sessions are stable—physical interface failure will not
tear down IBGP sessions.
• There is no BGP recovery after a failure inside the transit AS.
– The configured IGP will re-establish the path between
loopback interfaces.
– IBGP sessions are not affected.
© 2005 Cisco Systems, Inc. All rights reserved.
BGP v3.2—1-54
IBGP Next-Hop Processing
© 2005 Cisco Systems, Inc. All rights reserved.
BGP v3.2—1-55
Transit Network Using
External Next Hops
• All EBGP peers must be reachable by all
BGP-speaking routers within the AS.
• EBGP next hops shall be announced using
the IGP.
– Redistribute connected interfaces into the IGP at the edge
routers.
or
– Include links to EBGP neighbors into the IGP and
configure them as passive interfaces.
© 2005 Cisco Systems, Inc. All rights reserved.
BGP v3.2—1-56
Transit Network Using Edge
Routers as Next Hops
• Alternate design: Next-hop processing is modified at the edge
routers.
– Edge routers announce themselves as the next hop in IBGP
updates.
– No redistribution of external subnets is necessary.
– This design might result in suboptimal routing if multiple paths
to a neighboring AS exist.
• Use default next-hop processing if at all possible.
© 2005 Cisco Systems, Inc. All rights reserved.
BGP v3.2—1-57
Transit Network Using Edge
Routers as Next Hops Example
© 2005 Cisco Systems, Inc. All rights reserved.
BGP v3.2—1-58
Differences Between EBGP and
IBGP Sessions
• No BGP attributes are changed in IBGP updates.
• Because of BGP split horizon, routes learned from an IBGP
peer are not advertised to other IBGP peers.
• Local preference is propagated only over IBGP sessions.
• EBGP peers are directly connected; IBGP peers are usually
distant.
• Route selection rules slightly prefer EBGP routes.
© 2005 Cisco Systems, Inc. All rights reserved.
BGP v3.2—1-59
Differences Between EBGP and
IBGP Sessions Example
• Whenever identical routes are received from IBGP and EBGP peers,
the route from the EBGP peer is preferred.
© 2005 Cisco Systems, Inc. All rights reserved.
BGP v3.2—1-60
BGP Practical
Processing BGP Routes
© 2005 Cisco Systems, Inc. All rights reserved.
BGP v3.2—1-61
Outline
• Overview
• Receiving Routing Updates
• Building the BGP Table
• BGP Route Selection Criteria
• BGP Route Propagation
• Building the IP Routing Table
• Advertising Local Networks
• Automatic Summarization
• Summary
© 2005 Cisco Systems, Inc. All rights reserved.
BGP v3.2—1-62
Receiving Routing Updates
Small BGP Network
© 2005 Cisco Systems, Inc. All rights reserved.
BGP v3.2—1-63
Receiving Routing Updates (1-Cont.)
Information from the BGP tables is exchanged after adjacency
establishment.
© 2005 Cisco Systems, Inc. All rights reserved.
BGP v3.2—1-64
Building the BGP Table
All inbound updates are placed into the BGP table.
© 2005 Cisco Systems, Inc. All rights reserved.
BGP v3.2—1-65
BGP Route Selection Criteria
•
•
•
•
•
•
•
•
•
•
•
Exclude routes with inaccessible next hop
Prefer highest weight (1-local to router)
Prefer highest local preference (1-global within AS)
Prefer routes that the router originated
Prefer shortest AS path (1-only length is compared)
Prefer lowest origin code (1-IGP < EGP < Incomplete)
Prefer lowest MED
Prefer external (1-EBGP) paths over internal (1-IBGP)
For IBGP paths, prefer path through closest IGP neighbor
For EBGP paths, prefer oldest (1-most stable) path
Prefer paths from router with the lowest BGP router-ID
© 2005 Cisco Systems, Inc. All rights reserved.
BGP v3.2—1-66
BGP Route Selection Criteria (1-Cont.)
The best routes to the destination networks are selected
from the BGP table.
© 2005 Cisco Systems, Inc. All rights reserved.
BGP v3.2—1-67
BGP Route Propagation
The best BGP routes are propagated to BGP
neighbors.
© 2005 Cisco Systems, Inc. All rights reserved.
BGP v3.2—1-68
Building the IP Routing Table
The best BGP routes are copied into the IP routing
table based on administrative distance.
© 2005 Cisco Systems, Inc. All rights reserved.
BGP v3.2—1-69
Advertising Local Networks
• The BGP router process keeps a list of local networks (1defined with the network command or through redistribution).
• The BGP process periodically scans the IP routing table and
inserts or revokes routes from the BGP routing table based
on their presence in the IP routing table.
© 2005 Cisco Systems, Inc. All rights reserved.
BGP v3.2—1-70
Advertising Local Networks (1-Cont.)
The BGP route is revoked after the network is
removed from the routing table.
© 2005 Cisco Systems, Inc. All rights reserved.
BGP v3.2—1-71
Advertising Local Networks (1-Cont.)
The BGP route is advertised after the network
appears in the routing table.
© 2005 Cisco Systems, Inc. All rights reserved.
BGP v3.2—1-72