To work on networks and exchange data between routers, BGP networks use what is called a routing table to control and manage data packets. The routers generate the BGP table information using information from the incoming routers and the RIB (Routing Information Database) stored on the router. The RIB not only includes information about its external and internal peers, but also updates the routing table based on new information about the current BGP peer group and the paths, routers, and peers that are or are no longer available. BGP routers use TCP connections and TCP port 179 to exchange messages and data, for example:
- OPEN: initiates the information exchange of a BGP session.
- UPDATE: transmits information about changed or new paths.
- KEEPALIVE: regular KEEPALIVE messages acknowledge OPEN messages and inform connected routers that a session should be maintained.
- NOTICE: is used to remove routing paths or terminate a session if the KEEPALIVE message fails to appear.
BGP determines the best path for the data exchange based on the routing table and the path attributes in question, such as:
- Accessible Autonomous System (AS_PATH)
- Intermediate jumps or nodes required (Next Hop)
- Cost (IGP metric)
- Prioritized parallel connections (multi-exit discriminator)
BGP routing can be applied with IPv4 and IPv6 and other Internet protocols or MPLS labels. Moreover, BGP works according to the OSI model on the OSI transport layer to control the network layer.
By providing a constant exchange to available or new paths through BGP, BGP routers can create graphs to map network-embedded paths within and between autonomous systems. This ensures that data and information exchanges are reliable within networks, improves network stability and avoids the formation of loops.