Lesson 5 BGP
Lesson 5 BGP
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 2
BGP Fundamentals
• Border Gateway Protocol (BGP) is an EGP standardized path vector routing protocol
that provides scalability, flexibility, and network stability. When BGP was created, the
primary design consideration was for IPv4 inter-organization connectivity on public
networks like the Internet and on private dedicated networks.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 3
BGP Fundamentals
Autonomous System Numbers
From the perspective of BGP, an autonomous system (AS) is a collection of
routers under a single organization’s control, using one or more IGPs and
common metrics.
• An organization requiring connectivity to the internet must obtain an autonomous
system number (ASN) from the Internet Assigned Numbers Authority (IANA).
• RFC 4893 expanded the ASN field from 2 bytes to accommodate 4 bytes (32-bit
range). This allows for 4,294,967,295 unique ASNs, providing quite an increase from
the original 65,535 ASNs.
• The IANA requires organizations or individuals requesting AS numbers to meet the
following conditions:
• Proof of a publicly allocated network range
• Proof that Internet connectivity is provided through multiple connections
• Demonstrated need for a unique routing policy from their providers.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 4
BGP Fundamentals
Autonomous System Numbers (Cont.)
Similar to IP Addresses, the AS number assignments include private address
ranges that cannot be used for Internet traffic. These ranges are:
• ASNs 64,512–65,535 are private ASNs in the 16-bit ASN range.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 5
BGP Fundamentals
Path Attributes
BGP uses path attributes (PAs) associated with each network path. The
PAs provide BGP with granularity and control of routing policies within
BGP. The BGP prefix PAs are classified as follows:
• Well-known mandatory
• Well-known discretionary
• Optional transitive
• Optional non-transitive
Per RFC 4271, well-known attributes must be recognized by all BGP
implementations. Well-known mandatory attributes must be included
with every prefix advertisement; well-known discretionary attributes may
or may not be included with a prefix advertisement.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 6
BGP Fundamentals
Loop Prevention
BGP is a path vector routing protocol and does not contain a complete
topology of the network, as link-state routing protocols do. BGP behaves
like distance vector protocols, ensuring that a path is loop free.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 7
BGP Fundamentals
Address Families
• RFC 2858 added Multi-Protocol BGP (MP-BGP) capability by adding an extension called the
address family identifier (AFI).
• An address family correlates to a specific network protocol, such as IPv4 or IPv6, and additional
granularity is provided through a subsequent address-family identifier (SAFI) such as unicast or
multicast.
• MBGP achieves this separation by using the BGP path attributes (PAs) MP_REACH_NLRI and
MP_UNREACH_NLRI to carry different reachability information for the different address families.
• Every address family maintains a separate database and configuration for each protocol
(address family + sub-address family) in BGP.
• Some network engineers refer to Multiprotocol BGP as MP-BGP, and other network engineers
use the term MBGP. Both terms refer to the same thing.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 8
BGP Fundamentals
Inter-Router Communication
• BGP does not use hello packets to discover neighbors, as do IGP protocols, and it
cannot discover neighbors dynamically. BGP neighbors are defined by IP address.
• BGP uses TCP port 179 to communicate with other routers.
• Most recent implementations of BGP set the do-not-fragment (DF) bit to prevent
fragmentation and rely on path MTU discovery.
• BGP uses TCP, so unlike IGPs, it can form adjacencies with routers that are multiple
hops away.
• A BGP session refers to the established adjacency between two BGP routers. Multi-
hop sessions require that the router use an underlying route installed in the RIB
(static or from any routing protocol) to establish the TCP session with the remote
endpoint.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 9
BGP Fundamentals
Inter-Router Communication (Cont.)
BGP can be thought of as a control plane routing protocol or as an application
because it allows for the exchange of routes with a peer that is multiple hops
away.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 11
BGP Fundamentals
BGP Session Types (Cont.)
iBGP
Service providers provide transit connectivity. Enterprises should not.
Preventing an AS from becoming a transit AS by redistributing BGP
routes into the IGP is not a viable solution for the following reasons:
• Scalability - The internet has over 780,000 IPv4 network prefixes, IGPs
cannot scale to that level of routes.
• Custom routing - IGPs use metrics as the primary method of route
selection. BGP uses multiple steps to identify the best path or to
manipulate the path for a specific network prefix.
• Path attributes - All of the BGP path attributes cannot be maintained
within IGP protocols.
Establishing iBGP sessions between IGP routers in a full mesh
allows for proper forwarding between autonomous systems.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 12
BGP Fundamentals
BGP Session Types (Cont.)
eBGP
eBGP is the core component of BGP on the internet. The difference in behavior
for eBGP sessions and iBGP sessions are:
■ iBGP allows for multi-hop sessions. eBGP packets set the TTL to
one, so packets are dropped if multi-hop connections are
attempted.
■ The advertising router modifies the BGP next-hop address to the
IP address sourcing the BGP connection.
■ The advertising router prepends its ASN to the existing AS_Path variable.
■ The receiving router verifies that the AS_Path variable does not
contain an ASN that matches the local routers. BGP discards
the NLRI if it fails the AS_Path loop prevention check.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 13
BGP Fundamentals
BGP Messages
Table 11-2 BGP Packet Types
TYPE NAME FUNCTIONAL OVERVIEW
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 14
BGP Fundamentals
BGP Neighbor States
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 15
BGP Fundamentals
BGP Neighbor States (Cont.)
BGP forms a TCP session with neighbor routers called peers. BGP uses the finite-state
machine (FSM) to maintain a table of all BGP peers and their operational status.
• Idle - The first stage of the BGP FSM. BGP detects a start event and attempts to
initiate a TCP session with the BGP peer.
• Connect - BGP initiates the TCP connection. When the TCP handshake is completed,
the ConnectRetryTimer is reset, an Open message is sent to the neighbor, and the state
changes to OpenSent. During this stage, the router with the higher IP address manages
the connection.
• Active - BGP starts another TCP three-way handshake. If the connection is established
an Open message is sent and the state moves to OpenSent.
• OpenSent - If the OPEN message that is received by the originating router contains no
errors, the connection state moves to OpenConfirm
• OpenConfirm - In the OpenConfirm state, BGP waits for KEEPALIVE or
NOTIFICATION messages. Upon receipt of a neighbor’s KEEPALIVE message, the
state is moved to Established.
• Established - BGP neighbors exchange routes using UPDATE messages.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 16