Routing protocols are used to exchange routing information between routers. Routing protocols can be categorized into Interior Gateway Protocol (IGP) and Exterior Gateway Protocol (EGP). An IGP routing protocol, such as RIP, EIGRP, OSPF, and IS-IS can only be used to exchange routing information within an Autonomous System (AS). To exchange routing information between different ASs, an EGP routing protocol such as Border Gateway Protocol (BGP) is required.
BGP is used to connect and find routes to and from autonomous systems. It uses TCP port 179 to propagate and update the routing table (especially UPDATE and KEEPALIVE messages) to its neighbors.
Before exchanging any routing information, BGP routers must establish a TCP connection. The routers having a BGP session over a TCP connection are called BGP peers or BGP neighbors. Typically, BGP is considered as a Path-Vector protocol. However, sometimes it is also referred as an Advanced Distance-Vector protocol.
BGP protocol can be categorized into two categories: internal Border Gateway Protocol (iBGP) and external Border Gateway Protocol (eBGP). Routers belong to the same autonomous system use iBGP to exchange routing information. However, routers belong to the different autonomous systems use eBGP to exchange routing information. Routers that advertise their prefixes or routes are known as BGP speakers.
The following figure shows the use of iBGP and eBGP.
Border Gateway Protocol Messages
There are four types of messages that are used to exchange routing information between BGP peers. These are:
- OPEN Message: This message is sent as soon as a TCP session is established between two BGP peers. It is used to identify the AS of routers, to match the protocol parameters, and to decide the protocol timers.
- UPDATE Message: This message is used to exchange the topology information between the BGP speakers. It may contain the information regarding a new route and the routes that need to be deleted from the routing table. Keep in mind, only one new route can be advertised by an UPDATE message.
- NOTIFICATION Message: A BGP NOTIFICATION message is sent out when an error occurs during a BGP session. These messages can help administrators to troubleshoot the BGP connections or to find the reasons why the connection was terminated.
- KEEPALIVE Message: BGP peers use KEEPALIVE messages to confirm whether the connection between the BGP peers is still active or not. A BGP speaker sends a KEEPALIVE message to each peer at the regular intervals of one-third of the agreed hold time, which cannot be more than once per second.
When and when not to use BGP
BGP is a complex routing protocol. Using BGP in a network topology that is not suitable for the BGP can decrease the network performance. The following guidelines will help you to decide when to use BGP and when to not use BGP.
- BGP routing protocol is preferred in the following scenarios:
- When there is a need to send traffic through one AS to get to another AS.
- When there is a need to connect two or more ISPs, Network Access Points (NAPs), and exchange points
- When there is a need to use multi-homing in an enterprise network that connects more than one ISP.
- BGP routing protocol is not recommended in the following scenarios:
- When your router cannot support the huge routing tables required to support BGP.
- When there is a single connection to the Internet.
- When your network does not have sufficient bandwidth to support the amount of data needed to be passed.
In this post, we have discussed the basics of Border Gateway Protocol (BGP). Hope, it helped you. We would love to hear your suggestions.