BGP Border Gateway Protocol in depth

Om Khard
4 min readJun 3, 2021

Introduction

Border Gateway Protocol , I have discussed the basic BGP in Here . Lets see what it makes different from other protocols . Its an Application Layer routing protocol based on TCP packets . BGP is totally based on Path Vector Routing Algorithm , and metric for BGP is based on following factors:

  • cost
  • next-hop
  • best AS path selection
  • bandwidth
  • delay

As BGP is EGP(Exterior Gateway routing Protocol) and different than other IGP protocols (OSPF , RIP , EIGRP) . BGP uses AS routes and makes a database of AS paths . BGP has two types of protocol

  1. e BGP (external BGP)
  2. i BGP (internal BGP)
fig-1 BGP

Here in fig-1 , we have 3 Autonomous Systems Number connected with routes from AS100-AS200 and AS200-AS300 . So basically BGP have 3 types of tables :

  1. BGP Neighbour Table.
  2. BGP Routing Table
  3. BGP Distrbution Table or BGP Table.

So what happens during the handshake and during hello packets it all stores in the BGP Neighbour table . And the updated and initial routes get stored in the BGP Routing table . And BGP Distribution table takes all the information about the metrics to reach the destination i.e.(next hop , cost , delay and other factors). And BGP doesn’t uses the similar concept as IGP protocols to advertise the subnet it advertises its subnet using TCP based “Hello” packets .

Lets see through some configuration:

I have configured some basic iBGP and eBGP in the below topology , Let walkthrough .

Topology

TopoLogy

BGP Table / Distribution Table

fig-2 R4 BGP Table (Distribution of AS Path)
fig-3 R2 BGP Table

Here R2 and R4 share there AS path information as eBGP (i.e external BGP).

Routing Table

fig-4 The BOSS

At fig-4 we can see the different routes in Routing Table of BGP , take a look -in R4 we have external routes to the 2.0 and 3.0 network means the next-hop is located externally to the AS100 so the Administrative Distance shows 20 and for R2 in right side the Routing Table shows 200 administrative Distance because the next-hop is in the internal AS (“not in external AS” main concept) , this show the concept of eBGP and iBGP difference in BGP .

Neighbour Table

BGP Neighbour Table consists of the states of the neighbour routers , like ACTIVE , IDLE , ESTABLISHED , OPEN , OPEN_CONFIRM . These states says about the health or “state” of a connection if iBGP or eBGP.

BGP also performs the TCP’s 3 — way handshake before sending the UPDATE packets means when a router is in ACTIVE state .

fig-5 R4 Handshake TCP state
fig-6 R2 Handshake TCP state

Ping

To the local interfaces . Ping success … Yay!!!

Ping to the loopback interfaces , Let’s see …

BGP is fun now , until it pings .

BGP packets

There are 4 packets in BGP :

HELLO , UPDATE , KEEP-ALIVE , NOTIFICATION .

BGP stands on port number 179 , since its a TCP packets based protocol running upper the TCP layer it uses port number regardless of Network Layer Protocol that runs below TCP and uses protocol numbers.

for more knowledge about BGP look Here.

--

--