Skip to main content

BGP Peering Process

·509 words·3 mins
lab1918
Author
lab1918

In the BGP peering process, the establishment of the TCP session for the BGP connection involves specific source and destination ports, along with the concept of active and passive roles:

TCP Ports
#

The standard destination port for BGP is 179. The source port is usually a random high-numbered port (above 1023) chosen by the operating system of the initiating router.

Active and Passive Roles
#

The “active” role is taken by the BGP speaker that initiates the TCP connection. This speaker uses a high-numbered source port to connect to port 179 on the destination (the “passive” speaker). The “passive” role is taken by the BGP speaker that waits for an incoming connection on port 179.

Determining Roles
#

The roles are typically determined by the configuration. One router is configured to actively attempt the connection, while the other is configured to passively wait for the connection. In some configurations, both BGP speakers might be set to actively attempt the connection. In this case, they can still establish a connection, but the specifics of which router ends up being “active” or “passive” in the TCP sense can depend on timing and network conditions.

Establishment of Connection
#

Whichever BGP speaker actively initiates the TCP connection will use its random high-numbered port to reach the passive speaker’s port 179. Once the TCP connection is established, BGP OPEN messages are exchanged, and the BGP session proceeds as usual.

This mechanism ensures that the BGP session is reliably established and maintained, crucial for stable internet routing.

BGP speakers peer with each other using a process that’s quite structured and involves several steps. Here’s a simplified overview:

TCP Connection: BGP uses TCP (Transmission Control Protocol) for reliable communication. The standard port is 179. One BGP speaker initiates a TCP connection to another BGP speaker.

BGP Open Message
#

Once the TCP connection is established, both BGP speakers send an OPEN message. This message includes important information like the BGP version, the autonomous system (AS) number of the speaker, and a BGP identifier, usually the IP address.

Negotiation
#

The BGP speakers then negotiate parameters, like the version of BGP they will use and the keepalive intervals.

Keepalive Messages
#

After the negotiation, the speakers send KEEPALIVE messages to confirm the open session and to keep the session active over time. These messages are periodically sent to ensure the connection remains alive.

Update Messages
#

Once the BGP session is established, the speakers begin exchanging UPDATE messages. These messages contain routing information, announcing new routes or withdrawing previously announced routes.

Routing Information Exchange
#

BGP speakers continuously exchange routing information. They use this information to build and maintain a routing table, which includes the best paths to various network destinations.

The peering process is underpinned by a set of policies configured by the network administrator, which determines how routes are advertised and accepted. BGP is unique because these policies can be very complex, allowing a high level of control over routing decisions based on various attributes like path length, network policies, or traffic agreements.