Border Gateway Protocol (BGP) is a standardized exterior gateway protocol designed to exchange routing and reachability information among autonomous systems (AS) on the Internet. BGP is classified as a path-vector routing protocol, and it makes routing decisions based on paths, network policies, or rule-sets configured by a network administrator. BGP used for routing within an autonomous system is called Interior Border Gateway Protocol (iBGP). In contrast, the Internet application of the protocol is called Exterior Border Gateway Protocol (EBGP).
History In January 1989, at the 12th IETF meeting in Austin, Texas, Yakov Rekhter, Len Bosack, and Kirk Lougheed sat down at a table to design what ultimately became the Border Gateway Protocol (BGP). The initial BGP design was recorded on two napkins, hence often referenced to as the “Two-Napkin Protocol”. The design on the napkins was expanded to three hand-written sheets of paper from which the first interoperable BGP implementation was quickly developed. A photocopy of these three sheets of paper now hangs on the wall of a routing protocol development area at Cisco Systems in Milpitas, California. In the same year, RFC 1105 was published, and the BGP protocol (in various forms) has been in use on the Internet since 1994. Half a year after the initial publication, the protocol definition was changed in 1990 with the publication of RFC 1136. In October 1991, BGP version 3 was defined in RFC 1267, obsoleting the two earlier versions. In 1994, the current version (BGP4), was published as RFC 1654. Its definition was replaced in March 1995 by RFC 1771. In January 2006, RFC 4271 was published, which currently is the latest definition of BGP4 (although updated by many other RFCs). RFC 4271 corrected errors, clarified ambiguities and updated the specification with common industry practices. The major enhancement of BGP4 was the support for Classless Inter-Domain Routing (CIDR) and use of route aggregation to decrease the size of routing tables. In its native form, the BGP4 protocol can only work with IPv4 addresses. Since the publication of RFC 2283 in 1998, routing information about a wide range of "address families" (IPv4, IPv6, IPX, etc.) can be carried. The 'Multiprotocol Extensions' have been updated in 2000 with RFC 2858 and finally in 2007 with RFC 4760. With these extensions, the protocol is also referred to as Multiprotocol BGP (MP-BGP).
Operation BGP neighbors, called peers, are established by manual configuration among routers to create a TCP session on port 179. A BGP speaker sends 19-byte keep-alive messages every 30 seconds (protocol default value, tunable) to maintain the connection. Among routing protocols, BGP is unique in using TCP as its transport protocol. When BGP runs between two peers in the same autonomous system (AS), it is referred to as Internal BGP (iBGP or Interior Border Gateway Protocol). When it runs between different autonomous systems, it is called External BGP (eBGP or Exterior Border Gateway Protocol). Routers on the boundary of one AS exchanging information with another AS are called border or edge routers or simply eBGP peers and are typically connected directly, while iBGP peers can be interconnected through other intermediate routers. Other deployment topologies are also possible, such as running eBGP peering inside a VPN tunnel, allowing two remote sites to exchange routing information in a secure and isolated manner. The main difference between iBGP and eBGP peering is in the way routes that were received from one peer are typically propagated by default to other peers:
New routes learned from an eBGP peer are re-advertised to all iBGP and eBGP peers. New routes learned from an iBGP peer are re-advertised to all eBGP peers only. These route-propagation rules effectively require that all iBGP peers inside an AS are interconnected in a full mesh with iBGP sessions. How routes are propagated can be controlled in detail via the route-maps mechanism. This mechanism consists of a set of rules. Each rule describes, for routes matching some given criteria, what action should be taken. The action could be to drop the route, or it could be to modify some attributes of the route before inserting it in the routing table.
Extensions negotiation During the peering handshake, when OPEN messages are exchanged, BGP speakers can negotiate optional capabilities of the session, including multiprotocol extensions and various recovery modes. If the multiprotocol extensions to BGP are negotiated at the time of creation, the BGP speaker can prefix the Network Layer Reachability Information (NLRI) it advertises with an address family prefix. These families include the IPv4 (default), IPv6, IPv4/IPv6 Virtual Private Networks and multicast BGP. Increasingly, BGP is used as a generalized signaling protocol to carry information about routes that may not be part of the global Internet, such as VPNs. In order to make decisions in its operations with peers, a BGP peer uses a simple finite-state machine (FSM) that consists of six states: Idle; Connect; Active; OpenSent; OpenConfirm; and Established. For each peer-to-peer session, a BGP implementation maintains a state variable that tracks which of these six states the session is in. BGP defines the messages that each peer should exchange in order to change the session from one state to another. The first state is the Idle state. In the Idle state, BGP initializes all resources, refuses all inbound BGP connection attempts and initiates a TCP connection to the peer. The second state is Connect. In the Connect state, the router waits for the TCP connection to complete and transitions to the OpenSent state if successful. If unsuccessful, it starts the ConnectRetry timer and transitions to the Active state upon expiration. In the Active state, the router resets the ConnectRetry timer to zero and returns to the Connect state. In the OpenSent state, the router sends an Open message and waits for one in return in order to transition to the OpenConfirm state. Keepalive messages are exchanged and, upon successful receipt, the router is placed into the Established state. In the Established state, the router can send and receive Keepalive, Update, and Notification messages to and from its peer.
… excerpt ends here. Continue reading the full article.


![Border Gateway Protocol: A typical configuration of a BGP RR deployment.[39]: §6](https://thumb.wikimedia.org/wikipedia/commons/thumb/6/6e/RR_BGP.svg/500px-RR_BGP.svg.png?utm_source=en.wikipedia.org&utm_campaign=parser&utm_content=thumbnail)

