Understanding Bgp

Short summary

How BGP works is it will create a tree of possible path

Pasted image 20250304223746.png

The path to the destination (in this case AS1 — 207.126.0.0/16) is called AS_PATH. In this case we have 2 AS_PATH:

  • AS4, AS2, AS1
  • AS6, AS5, AS3, AS1

Which leads to AS1. BGP will choose the shortest path which is AS4, AS2, and AS1

Loop detection

AS (Autonomous System) detects a loop by checking if itself is reported in the AS_PATH. Taken this example:

Pasted image 20250304224145.png

We can see that AS7 will reject the path that has itself in it.

Understanding show ip bgp command

Pasted image 20250304224322.png

The Network column is the destination, each * is the same destination.

For example in here to reach to 3.0.0.0 we have multiple next hop from 217.75.96.60 to 193.0.0.56

The Path column shows which AS it goes through. We can see that in the end it all goes to AS 80 which indicate our destination is at AS 80.

The >* is the shortest path that the algorithm choose.

When 2 neighbors first establish a BGP peer connection, they exchange their entire BGP routing table at first. After that they will exchange incremental updates.

Understand BGP finite state