An Exterior Gateway Protocol is a routing protocol which is used to exchange routing information between autonomous systems. The first exterior gateway protocol was EGP (Exterior Gateway Protocol) which is now obsolete and replaced by Border Gateway Protocol (BGP), EGP was used in the early internet days but due its various problems BGP was introduced which is not the standard Exterior Gateway Protocol on the Internet, thus our lesson today will be based on BGP.
Border Gateway Protocol (BGP) was introduced in 1989 as an Inter-AS routing protocol in RFC 1105, over the years BGP was modified and upgraded and the current version which is version 4 was defined by RFC 1771 in 1995. The primary function of BGP is to exchange network layer reachability information with other BGP peers. The Network Layer Reachability Information (NLRI) include the IP Prefixes and a list of autonomous systems the NLRI has traversed. BGP does not have its own transport mechanism thus BGP uses the Transmission Control Protocol (TCP) for exchanging routing information. BGP peers use TCP establish peering and then exchange routing information, just like any TCP communication one BGP router is a TCP client that initiates the TCP connection to the server which is another BGP router on port 179. BGP also implements a keep-alive mechanism, ensuring that BGP routers know if BGP peers fail or there is loss of connectivity between them.
A BGP router consider each of its peers as either Internal (iBGP) or External (eBGP) peers based on which autonomous system the peer resides.
BGP works on the principle of enforcing policies. A policy is manually configured and allows a BGP router to rate possible routes to other autonomous systems, selecting the best path. Unlike IGPs, BGP does not use a metric to select the best route when multiple routes to the same destination exist. Instead, BGP uses several BGP path attributes and a decision process when choosing the best route when multiple routes exist.
The most important path attribute in BGP is the AS_PATH, it is a sequence of AS numbers to describe the inter-AS Path of the route. When a BGP speaker originates a route (when it advertise NLRI about a destination within its own AS ), it adds its AS Number to the AS_PATH. As subsequent BGP speakers advertise the route to external peers, they prepend their own AS Number to the AS_PATH, thus it describes all autonomous systems a route has passed through, beginning with the most recent and ending with the originating AS. AS_PATH attribute also provides loop prevention mechanism. If a BGP router receives a route from an external peer whose AS_PATH includes its own AS number then the route is dropped because of loop. When comparing two or more routes to the same destination, given that all higher-priority attributes are equal, a shorter AS_PATH is always preferred over a longer one. In case of a tie, other attributes are used to determine the best path to the destination.
In the diagram above is an enterprise that has been assigned a /24 pool of publically routable IP addresses is using BGP to advertise it to the Internet Service Provider.
R1(config)# router bgp 65450
R1(config-router)# network 22.214.171.124 mask 255.255.255.0
R1(config-router)# neighbor 126.96.36.199 remote-as 65535
The configuration as shown above is relatively simple in this case. A BGP Autonomous System number 65450 is configured. The neighbor command creates an eBGP peering with the ISP router and the network command is used to advertise the /24 pool to the ISP.
Note: The prefix defined by the network command must be present in the routing table for it to be advertised.
This brings us to the end of this lessons in which we discussed Exterior Gateway Protocols and the Border Gateway Protocol which is used as EGP on the Internet. BGP is a very vast protocol and several volumes of books can just be written on it alone. What we have covered is just a brief overview of BGP. As you will move ahead with your studies in higher Cisco Professional & Expert Certifications such as CCNP, CCIP and CCIE you will study indepth about this protocol.