Border Gateway Protocol is the only exterior gateway protocol in use today and its role is primarily to exchange routing information between organizations. BGP is a standard-based protocol defined in RFC 4271 and is the successor of EGP (Exterior Gateway Protocol).
Necessity of BGP
BGP is used to route between ASs and is considered to be a path vector routing protocol. Routing decisions are based on multiple attributes that can be tuned and controlled, resulting in the particular path the AS’s data will take (i.e., this is the routing decision). This is more of a policy based routing approach and policy routing is very important for ISPs routing traffic between each other for different ASs.
BGP is a classless routing protocol and it supports VLSM and summarization (route aggregation). While IGRPs can scale to thousands of routes, BGP can scale to hundreds of thousands of routes, making it the most scalable routing protocol ever developed. Currently, the global BGP routing table has over 300,000 routes.
Another characteristic of BGP is its high rate of stability, as there is never a solid convergence of the Internet routing table (i.e., something is always changing in such a large routing table). In addition, it is stable enough to handle routing and decision making at the same time. Because BGP focuses on the enforcement of policies, it does not use a simple metric value that might be tied to a single parameter (like bandwidth). Instead, BGP has a group of attributes that can be manipulated to dictate a particular routing policy.
When used to exchange routing information between organizations, BGP can be configured in two particular scenarios (see Figure 5.15 below):
- Transit networks: ISPs that want to provide transit to other destinations on the public Internet.
- Multi-homed networks: Big Enterprise Networks that rely heavily on Internet traffic and have sophisticated connectivity requirements to two or more ISPs. BGP allows them to control inbound and outbound routing policies.
Figure 5.15 – BGP Deployment Scenarios
Most of the Enterprise Networks do not need BGP and this is for various reasons:
- The network requires single ISP connectivity and default routing configuration is sufficient. A default route will point to the ISP so all Internet traffic is routed to that single ISP.
- Memory and CPU resources are limited and do not support a BGP implementation. The global routing table needs more than 1 GB of memory just for storage.
- Not owning the IPv4 address space in use. This happens in situations where the organization’s addresses are owned by the ISP, which is a frequent occurrence for small- and medium-sized organizations.
BGP Functionality
Similar to OSPF, IS-IS, and EIGRP, BGP uses a three-table data structure:
- Neighbor table: Contains information about adjacency with peers.
- BGP table (topology table): Contains all of the prefixes learned from peers.
- IP routing table: Contains the best routes from the BGP tables.
The devices running BGP will establish adjacencies to build the neighbor table and will then exchange updates to build the BGP table. After the BGP table is built, the best paths for routing information are chosen and are used to build the IP routing table. BGP allows for different peering types to be created:
- External BGP (eBGP) peering: BGP peering with a neighbor that is outside of the AS.
- Internal BGP (iBGP) peering: BGP peering with devices inside the AS.
Figure 5.16 – BGP Peering Types
Figure 5.16 above shows an example of BGP peering types. The BGP peering types a route is being sent to and received from will influence the update and path selection rules. An example of this is that eBGP peers are assumed to be directly connected. If they are not, a special command called “ebgp multihop” must be entered to let the devices know they are not directly connected and to establish the BGP peering. This assumption has no equivalent when considering iBGP peering, where there is no requirement for direct connectivity.
Another example regarding the iBGP versus eBGP behavior is that an eBGP-learned route will not be advertised between iBGP peers because of a special loop prevention mechanism that prevents an update learned via iBGP to be sent to other iBGP peers. This happens because BGP assumes that all routers within an AS have complete information about each other. Multiple solutions exist to solve this issue, including the following:
- Configure a full mesh of iBGP peers
- Use BGP Route Reflectors
- Organize the AS into BGP Confederations
The solution that involves a full mesh of iBGP peers is the least preferred because of the increased number of connections. The total number of connections is n*(n-1)/2, where “n” equals the number of BGP routers, so for 1,000 routers there would be 499,500 peers. This is very hard to implement and maintain, so the Route Reflector and Confederations solutions are recommended instead. Details about BGP Route Reflectors and BGP Confederations will be covered later in this chapter.
BGP Path Vector Attributes
BGP can use multiple attributes to define a routing policy and the most important are as follows:
- Next hop: This attribute must be present in each BGP update; it indicates where the traffic should be sent to reach a particular destination.
- AS-path: This attribute lists all of the Autonomous Systems through which the prefix has passed. AS-path is similar to a hop count, except it uses AS numbers and provides more details about the path.
- Origin: This attribute provides information about how the prefix entered the BGP system, either directly advertised into BGP with the “network” command or redistributed from other routing protocols.
- Local preference: This attribute influences the way traffic enters the AS and the path that it takes; it can also influence the way packets exit the AS and the path that they take.
- Community: This attribute groups destinations in a certain community and applies routing decisions according to those communities.
- Multi-Exist Discriminator (MED): This attribute influences the way traffic enters the AS and the path that it takes.
- Atomic aggregate: This attribute is used when performing BGP summarization.
- Aggregator: This attribute is used when performing BGP summarization.
BGP attributes can be grouped into several categories, such as well-known and optional. The well-known attributes are supported by all BGP vendors and the optional attributes are supported only by certain BGP vendors. BGP attributes can also be mandatory and discretionary. The mandatory attributes are sent in every routing update, while the discretionary attributes may or may not be present in routing updates. Another category relies on the path attribute’s transitivity, which can be either transitive (they pass between eBGP and iBGP neighbors) or non-transitive (they pass between iBGP neighbors only). Valid combinations of BGP attributes include the following:
- Well-known mandatory (next-hop, AS-path, origin)
- Well-known discretionary (local preference, atomic aggregate)
- Optional transitive (aggregator, community)
- Optional non-transitive (MED)
BGP systems will analyze all of these attributes and will determine the best path to get to a destination based on this very complex decision process. Only the best route is sent to the routing table and to the peers. Finding out whether the next hop is reachable must be determined first. If it is not, the prefixes will not have a best path available, but if it is, the decision process will analyze the following aspects:
- Weight (Cisco-specific attribute) – the highest weight is preferred.
- Local preference – the highest local preference is preferred.
- Locally originated routes – these are preferred.
- AS-path – the shortest AS-path is preferred.
- Origin – routes with the lowest origin type are preferred.
- MED – the lowest MED is preferred.
- Neighbor type – routes that came via eBGP over those that were learned via iBGP are preferred.
- IGP metric – if there is still a tie, the lowest IGP metric wins.
- If multiple paths exist in the routing table, the path that was received first is preferred.
- The route that comes from the BGP router with the lowest router ID is preferred.
- The path with the minimum cluster list length is preferred.
- The path that comes from the lowest neighbor address is preferred.
Scalable BGP
BGP typically has multi-homed links to ISPs and is found in MPLS VPN scenarios. When using BGP as an interior routing protocol, a full mesh of iBGP routers is necessary because they do not re-advertise routes that were learned from other iBGP peers, according to BGP behavior. Two methods for scaling iBGP and avoiding the need for a full-mesh topology are using Route Reflectors and Confederations.
BGP Route Reflectors
Route Reflectors (RRs) are nodes that reflect the iBGP updates to devices that are configured as RR clients. This solution is easy to design and implement and solves the iBGP split horizon rule. A full-mesh connection between RR nodes and normal nodes (non-RR clients) must be configured, but a full-mesh connection between the RR and its clients is not required. This concept is illustrated in Figure 5.17 below:
Figure 5.17 – BGP Route Reflectors
BGP RRs, defined in RF 2796, are iBGP speakers that reflect routes that were learned from iBGP peers to RR clients. They also reflect routes received from RR clients to other iBGP peers (non-RR clients). Route reflector client configuration is carried out only on the RR device, using the “neighbor <ip_address> route-reflector-client” command. This configuration process can be performed incrementally as more RRs or RR clients are added. The RR client will often establish peer sessions only with RR devices.
Figure 5.18 – BGP Route Reflector Redundancy
Often, redundant RRs are needed to avoid a single point of failure. An RR and its associated clients form an RR cluster, as depicted in Figure 5.18 above. In some situations there can be overlap in the RR clusters but this adds to the complexity of the design. RR functionality respects the following rules when propagating updates:
- When an RR receives a route from an eBGP peer, it sends the route to all clients and non-clients.
- When an RR receives a route from an RR client, it reflects the route to all RR clients and non-clients, as well as to all eBGP peers.
- When an RR receives a route from a non-client, it reflects the route to all RR clients and sends the route to all eBGP peers.
BGP Confederations
The second BGP scalability method is using BGP Confederations, as defined in RFC 3065. This implies injecting information into BGP routes using the AS-path attribute to prevent loops in the AS. This technique works by dividing a normal BGP AS into multiple sub-ASs. The only AS visible to the outside world is the outer AS (the Confederation AS). The BGP Confederation design is equivalent to having a VLAN and dividing it into private VLANs.
BGP Confederations are more complex than Route Reflectors and they function by creating sub-ASs within the main AS. The connections between sub-ASs behave like eBGP peer sessions and the connections inside sub-ASs are pure iBGP peer sessions. This means that only full-mesh configuration is needed inside the sub-ASs, where RRs can also be configured, so a combination of BGP design technologies is available.
Figure 5.19 – BGP Confederations
Analyzing Figure 5.19 above, the Confederation AS 100 has been configured, and within this confederation AS, three sub-ASs (Confederation internal peers) have been configured: 65001, 65002, and 65003. The connections between the devices in the same sub-AS are BGP Confederation internal peers and the connections between the devices in different sub-AS areas are BGP Confederation external peers, and they have many similarities to eBGP connections.
As iBGP information is exchanged within a Confederation AS, the sub-AS numbers are put into the Confederation sequence, which functions similar to the AS-path attribute as a loop prevention mechanism. The route advertisement rules are similar to the RR distribution rules:
- A route that is learned from an eBGP peer is advertised to all the Confederation external and internal peers.
- A route that is learned from a Confederation internal peer is advertised to all Confederation external and eBGP peers.
- A route that is learned from a Confederation external peer is advertised to all Confederation internal and eBGP peers.
Private AS numbers are used within a Confederation AS and are then removed from updates sent out of the Confederation. This makes BGP more scalable and allows the number of connections to be reduced.




