English

BGP

Updated on Apr 2, 2024 by
81

What Is BGP?

BGP, or Border Gateway Protocol, functions as a routing protocol designed for the exchange of network layer reachability information (NLRI) across different routing domains. These domains, commonly referred to as Autonomous Systems (ASs), are independently administered by various organizations. The Internet, being a vast interconnected network, comprises multiple ASs. BGP, particularly employed as an external routing protocol on the Internet, is extensively utilized among Internet Service Providers (ISPs).

Its primary purposes include the exchange of reachable routing information between ASs, establishment of inter-AS paths, prevention of routing loops, and the application of routing policies between ASs. Throughout its evolution, BGP has undergone three earlier versions: BGP-1, BGP-2, and BGP-3. Presently, the widely adopted and utilized version is BGP-4.

Why Do We Need BGP?

The need for BGP arises from the limitations of Interior Gateway Protocols (IGPs), which are specifically designed for providing reachability information within a single routing domain and lack the capability to efficiently handle routing between different domains.

The need for BGP arises from the limitations of Interior Gateway Protocols (IGPs), which are specifically designed for providing reachability information within a single routing domain and lack the capability to efficiently handle routing between different domains.

The need for BGP arises from the limitations of Interior Gateway Protocols (IGPs), which are specifically designed for providing reachability information within a single routing domain and lack the capability to efficiently handle routing between different domains.

The need for BGP arises from the limitations of Interior Gateway Protocols (IGPs), which are specifically designed for providing reachability information within a single routing domain and lack the capability to efficiently handle routing between different domains.

How Does BGP Work?

Roles in BGP Message Exchange

Speaker: A BGP speaker, a routing device sending BGP messages, is responsible for receiving or generating new routing information and advertising it to other BGP speakers. When a BGP speaker receives a route from another AS, it compares it with its local routes. If the received route is superior or new, the speaker advertises it to all BGP speakers, excluding the one that initially advertised the route.

Peer: BGP speakers that engage in message exchange with each other are referred to as peers.

BGP Messages

BGP operates through five types of messages: Open, Update, Notification, Keepalive, and Route-refresh.

  • Open: This initial message is sent after setting up a TCP connection. It establishes a BGP peer relationship. After receiving an Open message, if the negotiation succeeds, the peer sends a Keepalive message to confirm and maintain the peer relationship. Subsequently, peers can exchange Update, Notification, Keepalive, and Route-refresh messages.

  • Update: This message is used for sharing routing information between peers. An Update message can convey multiple reachable routes with identical attributes and can also delete multiple unreachable routes.

  • Notification: When BGP detects an error, it sends a Notification message to its peers, leading to an immediate teardown of BGP connections.

  • Keepalive: BGP periodically dispatches Keepalive messages to peers to validate BGP connections.

  • Route-refresh: This message requests peers to re-send all reachable routes to the local device.

BGP Processing

As BGP utilizes TCP as the transport layer protocol, peers must first establish a TCP connection before establishing a BGP peer relationship. Subsequently, to create a BGP peer relationship, peers negotiate parameters by exchanging Open messages. Once the peer relationship is established, BGP peers exchange BGP routing tables. Keepalive messages are sent to maintain BGP connections between peers. BGP doesn't regularly update routing tables; instead, it performs incremental updates through Update messages when BGP routes change. If an error is detected, BGP sends a Notification message to report the error, resulting in the teardown of the BGP connection.

BGP Finite State Machine

The BGP Finite State Machine (FSM) encompasses six states: Idle, Connect, Active, Open-Sent, Open-Confirm, and Established. Among these, Idle, Active, and Established are common states during the establishment of BGP peer relationships.

  • In the Idle state, BGP rejects all connection requests, serving as the initial state.

  • In the Connect state, BGP determines subsequent operations after establishing a TCP connection.

  • In the Active state, BGP endeavors to establish a TCP connection, marking an intermediate state.

  • In the Open-Sent state, BGP awaits an Open message from a peer.

  • In the Open-Confirm state, BGP expects a Notification or Keepalive message.

  • In the Established state, BGP peers can exchange Update, Route-refresh, Keepalive, and Notification messages. A BGP peer relationship is established only when both peers are in the Established state, facilitating the exchange of routing information via Update messages.

BGP Attributes

BGP attributes, also known as BGP route attributes, constitute a set of parameters describing specific BGP routes. BGP can filter and select routes based on these attributes, which are classified into four types:

  • Well-known mandatory: Identified by all BGP devices and must be carried in Update messages to avoid routing information errors.

  • Well-known discretionary: Identifiable by all BGP routers, this optional attribute may not necessarily be carried in Update messages.

  • Optional transitive: Signifying a transitive attribute between ASs, it is carried in messages even if a BGP device doesn't support it, advertising the information to other peers.

  • Optional non-transitive: If a BGP device doesn't support this attribute, it ignores it and doesn't advertise messages containing it to other peers.

Common BGP route attributes include:

  • Origin: A well-known mandatory attribute denoting the origin of path information and how a route becomes a BGP route. Origin attribute values include IGP, EGP, or Incomplete.

  • AS_Path: A well-known mandatory attribute recording AS numbers through which a route passes from the local end to the destination.

  • Next_Hop: A well-known mandatory attribute.

  • Multi-Exit-Discriminator (MED): An optional non-transitive attribute transmitted only between neighboring ASs. The receiving AS does not advertise MED to any third AS.

  • Local_Pref: A well-known discretionary attribute indicating the preference of a BGP route on a routing device. It is only valid between IBGP peers and is not advertised to other ASs.

How Does BGP Process Routes?

The diagram illustrates the BGP route processing workflow, encompassing the import, selection, summarization, and advertisement of routes. BGP routes are either imported from other protocols or learned from BGP peers. The process involves route summarization to optimize routing tables and the application of routing policies for route filtering or attribute modification.

Figure of BGP Route Processing Steps

Figure of BGP Route Processing Steps

Route Import

BGP, unable to discover routes by itself, imports routes from various routing protocols like IGPs or static routes. These routes are then stored in the BGP routing table. The import can occur in Import or Network mode. Import mode allows BGP to import routes based on protocol types (e.g., RIP, OSPF), while Network mode is more precise, importing routes with specified prefixes and masks.

Route Selection

In scenarios with multiple routes to the same destination, BGP employs routing policies for route selection. For instance, BGP may prioritize routes without recursion to an SRv6 TE Policy in the Graceful Down state. Route selection involves applying BGP origin AS validation results and considering factors like Valid, Not Found, and Invalid states when connected to a Resource Public Key Infrastructure (RPKI) server.

Route Summarization

To address the increase in the size of the BGP routing table as the network scale grows, route summarization is employed. This process condenses multiple routes into a summary route, reducing the number of specific routes advertised. BGP supports two types of summarization:

  • Automatic Summarization: Affects routes imported by BGP, summarizing routes by natural network segments. Only the summary route is sent to BGP peers.

  • Manual Summarization: Influences local BGP routes, providing control over the attributes of the summary route and the decision to advertise specific routes. While IPv4 supports both automatic and manual summarization, IPv6 only supports manual summarization.

BGP Route Advertisement Policies

BGP adheres to specific policies for advertising routes:

  • When multiple valid routes exist, BGP advertises only the optimal route to its peers.

  • Routes learned from EBGP peers are advertised to other BGP peers, including both EBGP and IBGP peers.

  • Routes learned from an IBGP peer are not advertised to other IBGP peers.

  • The advertisement of routes obtained from an IBGP peer to EBGP peers depends on the BGP-IGP synchronization state.

  • After establishing a connection, a BGP speaker advertises optimal BGP routes to the new peer.

This comprehensive route processing methodology in BGP ensures efficient management, selection, and distribution of routing information in diverse network scenarios.

What Extensions Does BGP Support?

BGP-4 is designed for managing IPv4 unicast routing information, limiting its functionality for other network layer protocols like IPv6 and multicast. To address this limitation, the Internet Engineering Task Force (IETF) introduced Multi-protocol Extensions for Border Gateway Protocol (MP-BGP), extending the capabilities of BGP-4. MP-BGP facilitates communication between routers supporting BGP extensions and those that do not.

Key Features of MP-BGP:

    • Support for Multiple Protocols:

MP-BGP provides routing information for various network layer protocols, including IPv6 (BGP4+) and multicast.

It maintains separate routing tables for unicast and multicast information.

    • Unicast and Multicast Support:

MP-BGP constructs different network topologies for unicast and multicast, allowing for distinct routing policies and configurations.

Unicast routing policies and methods applicable to BGP-4 can generally be used for multicast as well.

    • Address Families Differentiation:

BGP uses address families to distinguish between different network layer protocols.

MP-BGP supports multiple extensions, such as VPN and IPv6, each configured in its corresponding address family view.

Specific Address Family Views in MP-BGP:

    • BGP-IPv4 Unicast Address Family:

Maintains public network BGP peers and transmits public network IPv4 routing information.

Used in inter-AS BGP/MPLS IP VPN Option C or inter-AS BGP/MPLS IPv6 VPN Option C scenarios.

    • BGP-IPv6 Unicast Address Family:

Maintains public network IPv6 BGP peers and transmits public network IPv6 routing information.

Used in labeled IPv6 routes in 6PE scenarios.

    • Multicast-Related Address Families:

Includes BGP-IPv4 Multicast, BGP-MVPN, BGP-IPv6 MVPN, and BGP-MDT address family views.

Applied to MBGP, BIER, NG MVPN, BIERv6, and Rosen MVPN for transmitting inter-AS routing information.

    • VPN-Related Address Families:

Encompass BGP-VPNv4, BGP-VPNv6, BGP-VPN instance, BGP multi-instance VPN instance, BGP-L2VPN-AD, and BGP-L2VPN-AD address family views.

Mainly used in BGP/MPLS IP VPN, VPWS, and VPLS scenarios.

    • EVPN Address Family Views:

Includes BGP-EVPN and BGP multi-instance EVPN address family views.

Configured for BGP EVPN peers, applicable to EVPN VPLS, EVPN VPWS, and EVPN L3VPN.

    • Segment Routing Address Families:

Consists of BGP IPv4 SR Policy and BGP IPv6 SR Policy address family views.

Applied to Segment Routing MPLS (SR-MPLS) and Segment Routing IPv6 (SRv6).

    • Flow-Related Address Families:

Includes BGP-Flow, BGP-Flow VPNv4, BGP-Flow VPNv6, BGP-Flow VPN instance IPv4, and BGP-Flow VPN instance IPv6 address family views.

Utilized for defending against DoS/DDoS attacks to enhance network security.

    • BGP-Labeled Address Family Views:

Used for carrier configuration with the BGP label distribution solution.

    • BGP-LS Address Family Views:

Mainly used for summarizing topology information collected using IGP and sending it to the upper-layer controller.

These MP-BGP extensions significantly enhance the versatility of BGP, making it adaptable to diverse network layer protocols and advanced networking scenarios.

You might be interested in

See profile for undefined.
FS Official
Adaptive Routing
See profile for undefined.
FS Official
DHCP
See profile for undefined.
FS Official
Load Balancing