๐ค What is BGP? (Basic Idea)
Inside a small network (like a company), protocols like RIP and OSPF work well.
But the Internet is:
Huge ๐
Made of thousands of independent networks
Controlled by different organizations
๐ How do these large networks communicate with each other?
๐ Answer: BGP
๐ง Simple Definition
๐ BGP (Border Gateway Protocol) is an inter-domain routing protocol used to exchange routing information between different autonomous systems on the Internet.
๐ง One-Line Understanding
BGP decides how data travels between large networks on the Internet.
๐ง Real-Life Analogy
โ๏ธ International Flight Routing
Inside a city โ local roads (OSPF, RIP)
Between countries โ international air routes (BGP)
๐ BGP = Internetโs global traffic controller
๐งญ Where Does BGP Work?

BGP works at the Network Layer
Uses TCP (reliable delivery)
Uses Port 179
๐ This makes BGP reliable and stable.
๐งฉ What is an Autonomous System (AS)?
๐ An Autonomous System (AS) is a collection of IP networks controlled by a single organization that follows a common routing policy.
๐ง Examples of AS
ISP networks
Google network
University networks
๐ Each AS is identified by a unique ASN (Autonomous System Number).
AS15169 โ Google๐ Why BGP is Needed (Compared to OSPF/RIP)
Protocol | Scope |
|---|---|
RIP | Small internal networks |
OSPF | Large internal networks |
BGP | Between different networks (Internet) |
๐ BGP is used for inter-domain routing.
๐ง Type of Routing Protocol
๐ BGP is a Path Vector Routing Protocol
Protocol | Type |
|---|---|
RIP | Distance Vector |
OSPF | Link State |
BGP | Path Vector |
๐ง What is Path Vector Routing?
Routes include:
Destination network
Complete path of AS numbers
๐ This helps prevent routing loops.
๐งฎ Routing Metric Used by BGP
โ BGP does NOT use:
Hop count
Bandwidth
๐ BGP uses POLICY-BASED routing.
๐ Important BGP Attributes
Attribute | Purpose |
|---|---|
AS-PATH | List of ASes a route passes through |
NEXT-HOP | Next router to reach destination |
LOCAL-PREF | Preferred path inside AS |
MED | Entry point preference |
ORIGIN | Route source |
๐ Shortest AS-PATH is usually preferred.
๐งญ Types of BGP
๐ต 1. eBGP (External BGP)
๐ Used between different ASes
Example:
ISP โ ISP
Company โ ISP
๐ข 2. iBGP (Internal BGP)
๐ Used inside the same AS
Purpose:
Share external routes within AS
โ๏ธ iBGP vs eBGP
Feature | iBGP | eBGP |
|---|---|---|
AS | Same AS | Different AS |
Usage | Internal sharing | External routing |
Hop count | Not changed | Incremented |
๐ How BGP Works (Step-by-Step)

1๏ธโฃ BGP routers establish TCP connection
2๏ธโฃ Exchange OPEN messages
3๏ธโฃ Establish neighbor relationship
4๏ธโฃ Exchange routing updates
5๏ธโฃ Apply routing policies
6๏ธโฃ Best path selected
๐ BGP converges slowly but safely.
๐ฆ BGP Message Types
Message | Purpose |
|---|---|
OPEN | Start BGP session |
UPDATE | Share routing info |
KEEPALIVE | Maintain connection |
NOTIFICATION | Report errors |
๐ง Why BGP Uses TCP?
Reliable delivery โ๏ธ
Ordered updates โ๏ธ
No packet loss โ๏ธ
๐ Routing stability is critical for Internet.
๐ง Advantages of BGP
Scales to Internet size ๐
Prevents routing loops
Supports routing policies
Very reliable
โ Disadvantages of BGP
Complex configuration
Slow convergence
Requires expert knowledge
๐ง OSPF vs BGP
Feature | OSPF | BGP |
|---|---|---|
Scope | Intra-domain | Inter-domain |
Algorithm | Link State | Path Vector |
Metric | Cost | Policy |
Speed | Fast | Slow |
Usage | Enterprise | Internet |
๐ก๏ธ Security Issues in BGP
Route hijacking
Fake route advertisement
๐ Protection methods:
Route filtering
RPKI
Authentication
๐ง Memory Tricks
BGP = Big Global Paths ๐
AS = Autonomous System
179 = BGP port
Policy > Distance
โญ One-Line Summary
๐น BGP is a path-vector routing protocol that controls how data is routed between autonomous systems on the Internet.