BGP (Border Gateway Protocol)
Algorithm that finds the best route on internet from source ip to destination ip in global scale of multiple AS (Autonomous System) that can be run on Router.
The way it works is based on a concept called peering. Where we assign certains router as BGP peer (BGP Speaker)
- You can think these peer router is on the edge of AS (Autonomous System)
The way the algorithm works as follows
- Route discovery:
- The peers exchanges information with its neighbouring NLRI (Network Layer Reachibility Information)
- Each BGP (Border Gateway protocol) router then construct a graph
- Route storage:
- Collect the route advertisement (the broadcast from route discovery about NLRI (Network Layer Reachibility Information)) and store it in the routing table
- This table is update frequently
- Path selection:
- Use its algorithm to route the traffic optimally.
- Select the best one by evaluate its attribute based on loads or have a tie breaker algorithm
We call a Router is eBGP (External border gateway protocol) router if it handles the external routing and iBGP (Interior Border Gateway Protocol) router if it handles the internal routing.
[!important]
A router can be both eBGP (External border gateway protocol) and iBGP (Interior Border Gateway Protocol)
Example
We have 4 AS (Autonomous System) system with each BGP (Border Gateway protocol) peer connects like this
Now C
want to send a packet to B
.
Route discovery
Every here and there, these router will broadcast the NLRI (Network Layer Reachibility Information), which I will simplify to just have the hop count:
As you can see in here, both A
and D
are sending C
the advertisement information:
Basically A
is saying that it has 1 hop
from A -> B
and 1 hop
from A -> C
. Similarly, D
is saying that it has 1 hop
from D -> B
and 1 hop
from D -> C
.
Route storage
Based on these information, C
will construct a routing table contains its information
Path selection
From here, based on route storage, C
knows to reach B
it can go either A -> B
or D -> B
. It will decides based on the traffic load at A
or D
or any other condition