BGP Overview

Border Gateway Protocol is a Path Vector protocol that is primarily used to exchange Network Layer Reachability Information (NLRI) between routing domains or autonomous systems. In other words, BGP is used as an inter-domain or inter-autonomous system protocol. NLRI is exchanged between BGP routers, referred to as BGP speakers, using UPDATE messages. The NLRI is composed of a prefix and a length. The prefix refers to the network address for that subnet and the length specifies the number of network bits and is simply a network mask in CIDR notation while.

  • Example NLRI – or

Although BGP is a Path Vector protocol, it is also seen as a policy control tool. IGP’s are designed to provide reachability within a single autonomous system. But as for BGP, it was designed with greater policy control and scalability considerations.

BGP runs directly over TCP, using port 179. Because BGP runs over TCP, BGP peers establish a connection-oriented and reliable stream of data between them and can rely on TCP for the following services:

  • Acknowledgments
  • Segmentation and Reassembly
  • Checksums
  • Data sequencing
  • Flow control
  • Reliable Operation

Acknowledgments ensure the integrity of data delivered and guarantee that data will not be lost or duplicated. After sending a TCP segment, a retry timer starts decrementing until a receipt acknowledgment is received from the other end of the connection. When the timer reaches 0, the segment is retransmitted. The far-end acknowledgment is actually delayed up to 1 second to determine if any data should be sent along with the acknowledgment.

Segmentation and reassembly, the BGP data is segmented, if necessary, into smaller sizes for transmission across the network. If segmented, the data is reassembled at the destination. The checksum is maintained on both the TCP header and BGP data to ensure the transmission is error-free. If a received checksum is not the same as the advertised value, the segment will be discarded. No acknowledgment is sent to the source, and the segment is retransmitted.

Data sequencing involves the use of TCP sequence numbers which allow the receiving peer to reorder the BGP data in the event of an out-of-sequence receipt.

Flow control, each BGP peer advertises its available buffer space to allow the far end of the session to send only a specific amount of data. This prevents a sending host from overflowing the buffers of a receiving host (Forms of flow control are buffering, windowing and congestion avoidance).  Also because TCP uses the three-way handshake to establish a virtual circuit between the sending a receiving host, a reliable connection is established between TCP hosts.

Cisco BGP Process

  • The BGP Open process – used for peer establishment. This process runs at initialization, when establishing a TCP connection with a BGP peer.
  • The BGP I/O process – handles the reading, writing, and execution of BGP messages, such as the UPDATE and KEEPALIVE messages, at the interface between TCP and BGP.
  • The BGP Scanner process – periodically scans the BGP Routing Information Base (RIB) in order to determine if prefixes and attributes should be deleted and if route map or filter caches should be flushed. Also the BGP Scanner walks the BGP table and confirms reachability of the next hops. By default, the BGP Scanner runs every 60 seconds.
  • The BGP Router process – sends and receives routes, establishes peers, and interacts with the RIB. This process is also used to calculate the BGP best path and receives commands entered via the CLI.

Under the BGP router process there are three components that can be found;

  1. The BGP Routing Information Base – contains network entries, path entries, path attributes, and additional information such as route map and BGP filter list cache entries.
  2. The IP Routing Information Base for BGP-learned Prefixes – are stored in the IP RIB in two types of structures, which are Network Description Blocks (NDBs) and Routing Descriptor Blocks (RDBs). An NDB is a single entry in the routing table that represents a network prefix and contains information such as the network address, mask, and administrative distance. The NDB is stored in the routing table with a RDB, which is used to store the actual next hop information.
  3. The IP Switching Component for BGP-learned Prefixes – are structures such as the Forwarding Information Base (FIB) which is applicable when Cisco Express Forwarding (CEF) is enabled.

BGP Characteristics

BGP has the following characteristics:

  • Reliability – BGP runs directly over TCP, using port 179. Because TCP is a reliable, connection-oriented protocol, BGP does not need to worry about update retransmissions, fragmentation, acknowledgements, and sequencing because these are all performed by the underlying protocol, TCP. Also BGP establishes a session between BGP speakers. This connection-oriented session is maintained by regular keepalives. When a BGP speaker fails to receive keepalives within a specified interval, the session with the neighbor is closed and all of the BGP routing and forwarding information for that session is cleared by the local BGP speaker. Also BGP uses path attributes to prevent routing loops and ensure that the next hop IP address for a specified BGP prefix is reachable before BGP uses the next hop address to forward packets to that destination prefix.
  • Stability – BGP provides more features than traditional IGPs that can be used to ensure a stable topology. In addition to timers, BGP can also be configured to monitor routing information for signs of instability using route flap dampening. Route dampening is used to penalize route or prefix entries that are repeatedly transitioning between the up and down states. BGP also allows for the soft reset of neighbor sessions when routing policy changes and updates need to be sent. Soft resets are used to change the BGP policy without resetting the BGP session. This capability prevents packet loss or even the black holing of traffic if the session is reset and all routing information for that session was flushed.
  • Scalability – An external BGP (eBGP) implementation does not require all the routers within an autonomous system to participate in the BGP protocol. Only the border routers that provide connectivity between the local autonomous system and its adjacent autonomous system(s) participate in BGP. This means an eBGP implementation can scale to support hundreds of peer sessions and well over one hundred thousand prefixes.
  • Flexibility – is provided by the number of path attributes that can be used to define BGP policies. It is for this reason that BGP is considered first and foremost a policy tool and then a routing protocol.  BGP path attributes can be used to define both routing policies, such as how traffic routes in and out of an autonomous system, and administrative policies, such as limiting the number of prefixes received from a specific autonomous system for example.

BGP AS Numbering

To enable BGP on you router you must first configure it with an AS number;

Router(config)#router bgp [autonomous system number]

By applying this command you are enabling your router to become a BGP speaker. A router can only be configured/belong to one BGP AS number. A BGP peer relationship can be established between two BGP speakers in different autonomous systems, which is referred to as an external BGP (eBGP) relationship, or between BGP speakers within the same autonomous system, which is referred to as an internal (iBGP) relationship.

BGP uses both public and private AS numbers. The configuration AS range for BGP is 65, 535, or 16 bits, the top 1024 AS numbers, i.e. autonomous system numbers 64,512 through 65,535 are considered private autonomous system numbers and cannot be used on the Internet. Private autonomous system numbers are used to conserve globally unique AS numbers. Autonomous system numbers 1 through 64,511 are considered public AS numbers which can be used on the Internet. While any organization can use private AS numbers within their enterprise network, public AS numbers must be obtained from a regional registry.

BGP Path Selection Process

1. Largest Weight – Cisco proprietary. Only valid on the router it is configured on. It is not passed to other routers.

2. Highest Local Preference – Highest Local Pref is preferred, default is 100. Local Pref does not get passed between different ASs
– Due to the above reason, customers are sending/using BGP community string within their announcements
– Local Pref does get passed between confederations (sub-ASs).

3. Locally Originated – Prefer the path that was locally originated via a network or aggregate BGP subcommand, or through redistribution from an IGP. Local paths sourced by network or redistribute commands are preferred over local aggregates sourced by the aggregate-address command.

4. Shortest AS Path – An AS_SET counts as 1, no matter how many ASs are in the set.
– The AS_CONFED_SEQUENCE and AS_CONFED_SET are not included in the AS_PATH length.
– (**Confederation hops ARE NOT counted as hops)

5. Lowest Origin Type – Prefer the path with the lowest origin type: IGP is lower than EGP, and EGP is lower than INCOMPLETE. (IGP < EGP < Incomplete)
– IGP origin is created when there is a network statement
-EGP origin is created via a redistribute
-Incomplete origin is created via a redistribute

6. Lowest MED(multi-exit discriminator) – Only compared when the AS path entering our network is the same. MED is assigned by the end-user.

7. eBGP over iBGP – eBGP routes are preferred over iBGP routes. eBGP routes are those learned via eBGP sessions (ie different ASs). iBGP routes are learned via iBGP sessions (same AS).

8. Lowest IGP metric – IGP metrics are the internal routing protocols that BGP uses to reach the next-hop ip address.
– Prefer the path with the lowest IGP metric to the BGP next hop. Continue, even if bestpath is already selected.

9. Maximum paths – Check if multiple paths need to be installed in the routing table for BGP Multipath.

10. Oldest one(External) – When both paths are external, prefer the path that was received first (the oldest one). This step minimizes route-flap, since a newer path will not displace an older one, even if it would be the preferred route based on the next decision criteria.

11. Lowest Router ID – Prefer the route coming from the BGP router with the lowest router ID.
-If a path contains route-reflector (RR) attributes, the originator ID is substituted for the router ID in the path selection process
– The router ID is the highest IP address on the router, with preference given to loopback addresses. It can also be set manually using the bgp router-id command.

12. ORIGINATOR_ID – This will only be present in BGP route-reflector environments

13. Lowest IP – Prefer the path coming from the lowest neighbor address. This is the IP address used in the BGP neighbor configuration, and corresponds to the remote peer used in the TCP connection with the local router.