What is BGP?
BGP is considered, quite literally, the protocol which would be making the internet to work. BGP is a short form of Border Gateway Protocol and it is the routing protocol which would be used to route traffic across the internet. Routing Protocols like the BGP, OSPF, RIP, EIGRP, are designed to help out the routers advertise adjacent networks and since the internet is a network of networks, BGP helps in order to propagate these networks to all BGP Routers across the globe. Before we get to the working of BGP, if you have made up your mind in making a career in the IT Sector, check out the courses offered by the SPOTO.
Working of BGP:
Within the Internet, an autonomous system (AS) is considered as the network which would be controlled by a single entity typically an Internet Service Provider or a very large organization with independent connections to multiple networks.
These Autonomous Systems are going to be officially registered under autonomous system number (ASN), which they would be gaining from their Regional Internet Registry: AFRINIC, LACNIC, APNIC, ARIN or RIPE NCC. A unique ASN (AS Number) is also allocated to each AS for utilizing in BGP routing. AS numbers are considered to be quite important because the ASN is going to uniquely identify each network on the Internet.
Two routers that would be having established connection, so as to exchange BGP information, would be referred to as BGP peers. Such BGP peers exchange routing information between them through BGP sessions that run over TCP, which would be considered as a reliable, connection-oriented & error-free protocol.
Selecting the Best Path
Once the BGP Session is established, the routers could be advertised a list of network routes that they have been accessing to and will scrutinize them to find the route along with the shortest path. Of course, BGP doesn’t make sense when you would be connected only to one other peer like your ISP, because he is always going to be the best to other networks. However, while you are connected to multiple networks at the same time, then certain paths would become shorter, faster or more reliable than others. For example, Google's AS15169 peers along with 270 other networks, one of which would be the Digital Ocean Inc. AS14061. They both are connected to other ISPs for the internet, however this way since they would be having now peered together, they could be exchanging routing information, so now their router could choose a shorter path of connectivity, that they are having between themselves. If such neighbor-ship is broken for some reason or another, then their routers could be re-arranged their routing tables to reach those Autonomous Systems through other Autonomous Systems like the Tier 1 ISPs like: Cogent (AS174), TeliaSonera (AS1299), Level 3 (AS1, AS3356, AS3549), NTT (AS2914), AT&T (AS7018), etc.
BGP would be utilizing TCP as its transport protocol (port 179). Two BGP routers form a TCP connection between one another and exchange messages so as to open as well as confirm the parameters of the connections.
Any two routers that have formed a TCP connection so as to exchange BGP routing information are called peers, or neighbors. BGP peers would initially exchange their full BGP routing tables. After this exchange, incremental updates would be sent as changes occurred in the routing table. BGP keeps a version number of the BGP table, which should be the same for all of the BGP peers. The version number changes whenever BGP would be updating the table due to changes in routing information.
If you wish to gain more knowledge regarding the BGP and How it works in more detail, you could gain it through the training courses, which you could gain at the SPOTO.