Internet > How
the Internet works > Routing > EGP
Border Gateway Protocol (BGP)
The most common Exterior Gateway Protocol protocol in use on the Internet is the Border Gateway Protocol (BGP), ensuring that packets get to their destination network regardless of current network conditions.
Like RIP, the BGP algorithm provides great network stability, guaranteeing that if one Internet network line goes down, BGP routers can quickly adapt to send packets through another connection. The following subsections provide information on how BGP was invented, how BGP works, the BGP algorithm, and more BGP information
How BGP was invented. BGP was initially created in three different implementations. Then, in a standard Internet approach, they were used together to show that separate implementations of the protocol could interoperate without problems.
How BGP works. When a BGP router first comes up on the Internet, either for the first time or after being turned off, it establishes connections with the other BGP routers with which it directly communicates. The first thing it does is download the entire routing table of each neighboring router. After that it only exchanges much shorter update messages with other routers.
BGP routers send and receive update messages to indicate a change in the preferred path to reach a computer with a given IP address. If the router decides to update its own routing tables because this new path is better, then it will subsequently propagate this information to all of the other neighboring BGP routers to which it is connected, and they will in turn decide whether to update their own tables and propagate the information further.
BGP uses the TCP/IP protocol on port 179 to establish connections. It has strong security features, including the incorporation of a digital signature in all communications between BGP routers.
Each BGP router contains a Routing Information Base (RIB) that contains the routing information maintained by that router. The RIB contains three types of information:
BGP routers exchange information using four types of messages:
Routing messages are the highest precedence traffic on the Internet, and each BGP router gives them first priority over all other traffic. This makes sense -- if routing information can't make it through, then nothing else will.
The BGP algorithm. The BGP algorithm is run after a BGP router receives an update message from a neighboring router, and consists of the following three steps performed for each IP address sent from the neighbor:
One of the other important functions performed by the BGP algorithm is to eliminate loops from routing information. For example, a routing loop would occur when router A thinks that router B has the best path to send messages for some computer and B thinks the best path is through C, but C thinks the best path is back through A. If these sort of routing loops were allowed to happen, then any message to that computer that passed through routers A, B, or C would circulate among them forever, failing to deliver the message and using up increasing amounts of network resources. The BGP algorithm traps and stops any such loops.
The BGP protocol has been periodically revised, and is now at version 4. Each version can support all earlier versions. Different BGP routers may run different versions of BGP, so the protocol includes the following clever method for ensuring that different versions can communicate. When one BGP router tries to communicate for the first time with a second BGP router, it sends it an Open message including the highest version of BGP that it supports. If the second router cannot support that version, it sends back a Notification message with the highest version that it can support. The first router then opens a connection using that lower version, so that the two routers can then communicate at the highest version of BGP they both support.