BGP protocol summary (1)

BGP Border Gateway Routing Protocol

BGP is a classless path vector protocol

1. The difference between IGP and EGP

protocol Routing protocol representative advantage
EGP External Gateway Routing Protocol BGP 1. Strong controllability (it is convenient for administrators to select routes by policy interference)
2. Strong reliability, work based on TCP (BGP protocol devices need to interact a large number of routing entries, but they cannot choose periodic updates to occupy link resources, so Only trigger updates can be performed; and in the BGP protocol working environment, in order to save costs, non-direct connection establishment-unicast neighbors will inevitably occur)
IGP internal gateway routing protocol RIP、OSPF、EIGRP 1. No loop (good route selection)
2. Fast convergence
3. Small resource occupation

2. BGP features

  • BGP only sends unicast messages and needs to establish an independent point-to-point connection with each peer
  • BGP is an application layer protocol that uses TCP (port number 179), which relies on the inherent characteristics of TCP to achieve session maintenance functions (such as confirmation retransmission and sequencing)
  • BGP is a vector protocol, because BGP treats the route to the destination as a path through a series of autonomous systems. So it is called path vector protocol.
  • BGP routing uses the AS_PATH routing attribute to describe the path vector. AS_PATH lists the AS numbers contained in Lujin reaching the destination in sequence.
  • The AS_PATH attribute is a shortest path determinant. If there are multiple paths to the same destination, the path with the least AS number in AS_PATH is the shortest path.
  • Incremental update—only trigger without cycle
  • It has rich attributes to replace the metric in IGP for routing-multiple parameter control protocols
  • It is possible to implement a powerful strategy on the flow of incoming and outgoing items-controllability
  • It is not used for load balancing by default-----only one best path is generated through various routing rules
  • BGP supports authentication and aggregation (summary)

3.BGP data packet

Before establishing a BGP peering connection, two neighbors must perform a standard TCP three-way handshake and open a TCP connection on port 179. All BGP messages are transmitted to neighbors via TCP connections in unicast mode.

4 basic message types:

Open message

Keepalive message

Updata (update) message


1.Open message

After the TCp session is established, the two neighbors need to send an Open message. Each neighbor uses the message to identify itself and specify BGP operating parameters.

2. Keepalive news

If the router accepts the parameters specified in the Open message sent by the neighbor, it will respond with a Keepalive message. After that, IOS will send a Keepalive message every 60 seconds by default, or send a Keepalive message at 1/3 of the negotiated hold time.

3.Updata message

Used to announce feasible routes, withdraw routes, or both.

4.Notification message

After the router detects an error, it will send a Notification message and always close the BGP connection

4. BGP working process

[1] After the configuration is completed, the neighbors unicast TCP three-way handshake, and the target port 179 establishes a TCP session; after that, all BGP protocol data packets are transmitted based on the session.

After the session is established, the neighbors normally send and receive an open message to establish a BGP neighbor relationship and generate a neighbor table;

The open message of the BGP protocol carries the local RID—the generation method is always the same as the ospf; only the local and all local neighbors are unique.

[2] After the neighbor is shut down and established, the Keepalive period is used to keep the neighbor relationship alive by default every 1 min (periodical keepalive TCP session). The administrator selectively announces the routing entries obtained from any source in the local routing table to the BGP protocol; uses Updata packets for routing sharing between neighbors; and then generates the BGP table.

[3] After the convergence is completed, only the Keepalive period is kept alive

[4] If an error message appears, the neighbors will use the Notification message to report the error.

Structural mutation:

[1] New: Local use Updata to notify all local neighbors, provided that the route is not included in the aggregated route that has been sent.

[2] Disconnect: Local use Updata to notify all local neighbors, provided that the route is not included in the aggregated route that has been sent.

[3] Unable to communicate: hold time 3min, fail to receive keepalive from neighbor for 3 consecutive times, disconnect neighbor relationship, TCP session, and delete all routes learned from the neighbor.

5. BGP routing black hole

​ Non-direct connection establishment makes the control plane route entries reachable, and the recursive route is reachable, but the data plane traffic cannot pass through the router without running the BGP protocol.
Insert picture description here


  • 1. Physical and logical topology full connection (physical link direct connection or VPN)
  • 2. Neighbor relationship is fully connected (all devices in the network run BGP)
  • 3. BGP redistributes to IGP
  • 4. MPLS (multi-protocol label switching)

6. BGP loop prevention mechanism (Split Horizon)

1. EBGP split horizon

Rely on an attribute in the BGP routing entry for loop prevention (AS_PASH path attribute). The BGP protocol records the numbers of all ASs that pass through in the process of transmitting routing entries.

EBGP split horizon: If there is a local AS number in the received routing entries, the entry will be denied entry.

2. IBGP split horizon

Insert picture description here

The local routing entries learned from an IBGP neighbor must not be passed to other local IBGP neighbors.

Under the restriction of IBGP split horizon, although IBGP loops are avoided, at the same time, in order to transmit routing entries within the AS, an IBGP neighbor relationship must be established between the two. The neighbor relationship increases exponentially. Can use federation, route reflector to solve.

Guess you like