An Introduction to the BGP Protocol
By Erik Rodriguez
This article describes the different BGP protocols, what they are for, and how they work. This is an advanced topic that requires an extremely high level of patience and desire to learn. BGP routing is probably one of the most complex areas of networking.
The Border Gateway Protocol often known as BGP, is used mostly by ISP's to share information about different networks. BGP itself is a complex exterior routing protocol that is used in conjunction with autonomous systems. It is originally cataloged as RFC 1163. If you don't know what an RFC is, click here. Autonomous systems (abbreviated AS) are nothing more than a network or group of networks under common control. For more information on AS, see the article on route servers. There are several variations of the BGP protocol, so lets explore them:
BGP4 is an enhanced version of BGP that performs special operations to reduce the size of the routing table. This includes the use of classless interdomain routing (CIDR). For purpose of this article anytime BGP is mentioned, I am talking about BGP4 as defined by RFC 1771.
IBGP is used "inside" an autonomous system. This works much like a "network neighborhood." IBGP is used inside the confines of its own AS, but cannot be used in conjunction with a different AS.
EBGP works just the opposite of IBGP. It transports information to other BGP enabled systems. However, EBGP is generally not used within the same AS. In rare cases, EBGP can be used in place of interior protocols (IGRP, RIP, etc.) through the specification of static routes.
EGP is the "pre-BGP" protocol. Its basic meaning is Exterior Gateway Protocol. It is clearly distinguishable from IGRP (Interioer Gateway Routing Protocol).
To illustrate how IBGP and EBGP work, study the diagram below. Notice that there are 3 different autonomous systems. Bellsouth, AT&T, and Sprint are sharing information with each other via EBGP. However, the routers in each AS are using the IBGP to send information. EBGP is run on the "backbone" links, while IBGP is run on the interior trunk links (usually a SONET ring) that connect each router inside their own AS.
Remember that the main difference between BGP and other routing protocols such as RIP or IGRP, is the fact that it is an external protocol. It is important to know the distinction between an interior and exterior protocol. The main difference is that nobody is using BGP as the routing protocol for a LAN of say 50 users in an office. BGP is only used by ISP's or extremely large private networks that span across the globe.
Like every routing protocol, there is a set of parameters that are used to determine the best "route" for each packet of data. These parameters known as "attributes" are listed and explained below.
- Local Preference
- Multi-Exit Discriminator
- Next Hop
A Cisco proprietary rule, the weight attribute and it works in a strange way. It works like this, if two routes are advertised from the same AS, both routes will be entered into the receiving routers BGP routing table. However, only the route with the strongest weight will be entered into the routers IP routing table. The weight values can range from 0 to 65535. Paths that the router creates itself have a default value of 32768 (how did Cisco come up with that number?). Routers with a higher weight are ALWAYS used. Do not confuse the BGP routing table and IP routing table They are two totally different tables. Cisco routers can be configured to share data between the two tables, but it it not necessary to ensure proper BGP communication. See the image below:
This attribute works much like the weight attribute except for the fact that it is only processed inside an AS. The local preference attribute is only used with IBGP and its only purpose is to find the best exit point. Values are assigned to each router just as they are using the weight attribute. Notice in the image below that AS 53123 has established that router A will communicate with AS 54612.
This attribute works much like the two above. Remember that BGP is very complicated routing protocol that uses all of these attributes to determine the best path for data. The Multi-Exit Discriminator (MED) is a value assigned to a route based on a metric value. Unlike the 2 attributes above, MED is concerned with the lowest value.
The origin attribute is simple. The origin indicates how the router learned each BGP route. For instance, this could be one of the three listed below.
- EBGP - Route learned from other another AS or BGP network
- IBGP - Route learned from inside its own AS or BGP network
- Incomplete - It is unknown how the route was learned. The route was learned in some other way and usually happens when a route is redistributed into BGP.
Origin works hand in hand with the AS_path attribute discussed in the next section.
The AS_path is probably the most complicated constraint. It is somewhat hard to understand, so I will do my best to explain it. As a route passes through an AS, that AS number is inserted into the front of a compiled list. The list is compiled as it passes through each AS. As you can image these lists can be very long. So, when the final destination is reached, the list is complete. The originating AS_path at the end of the list, and the final AS_path is at the beginning of the list. The main purpose of this attribute is to stop "looping." As advertised routes bounch around, if the AS number already exists in the AS_path list, it will be rejected. However, this attribute works stictly with EBGP and is not useful is IBGP.
The next hop attribute is used between both IBGP and EBGP systems. Its basic function is to give directions of the path between two BGP routers. For example, if router A needs to communication with router B, the next hop attribute will give directions for the proper route through each router.
Creating communities is a way of grouping destinations. "Route maps" are used to each community attribute. There are 3 predefined community attributes:
- No-Export - Route is not advertised to EBGP neighbors.
- No-Advertise - Route is not advertised to ANY other networks.
- Internet - Route is advertised to the whole Internet community.
NOTE: this form DOES NOT e-mail this article, it sends feedback to the author.