Knowledge Base

BGP Fundamentals: A Beginner’s Guide to Understanding Dynamic Routing

Last updated: Nov 19, 2026
  1. What Is BGP? BGP (Border Gateway Protocol) is a dynamic routing protocol that allows routers to exchange information about which...

 

1. What Is BGP?

BGP (Border Gateway Protocol) is a dynamic routing protocol that allows routers to exchange information about which networks they can reach.

It is commonly used to connect different organizations, Internet Service Providers (ISPs), and large enterprise networks.

Simple Definition:

BGP is a routing protocol that helps routers learn about other networks and select the best available path to reach them.

Real-Life Example

Imagine you want to travel from one city to another.

There may be multiple roads available. A navigation system helps you choose a suitable route.

Similarly, BGP helps routers select a preferred network path using routing information and policies.

2. Why Do We Need BGP?

Routers need routing information to forward data between different networks.

In small networks, administrators can manually configure static routes.

However, when networks become larger or multiple connections are available, manually managing all routes becomes difficult.

BGP allows routers to exchange routing information dynamically.

Benefits of BGP
  • Automatic Route Learning: Routers learn network routes from their BGP neighbors.
  • Best Path Selection: BGP selects a preferred route when multiple paths are available.
  • Scalability: Supports communication between large networks.
  • Routing Control: Allows administrators to control which routes are shared.
  • Redundancy: Can provide alternative routing paths when multiple connections exist.
3. How Does BGP Work?

Consider two offices connected through routers.

  • Office A has its own network.
  • Office B has a different network.
  • Both offices want to communicate.

Initially, each router knows about its own directly connected network.

BGP allows both routers to exchange information about their networks.

BGP Working Process

Step 1: Establish Connection

The routers establish a BGP session with each other.

Step 2: Exchange Routes

Each router informs the other about the networks it can reach.

Step 3: Learn Networks

Both routers learn the available network routes.

Step 4: Select the Best Path

BGP selects the preferred route based on available paths and routing policies.

Step 5: Forward Traffic

The routers use the selected routes to forward traffic toward the destination.

Remember: BGP exchanges routing information. The router’s forwarding table is ultimately used to forward data packets.

4. What Is an Autonomous System?

An Autonomous System (AS) is a group of networks managed by a single organization or routing administration.

Every Autonomous System has an identifying number called an Autonomous System Number (ASN).

Simple Example

Imagine three companies:

  • Company A manages its own network.
  • Company B manages its own network.
  • Company C manages its own network.

Each company can operate its own Autonomous System.

BGP helps these organizations exchange routing information.

Local AS

The Autonomous System to which your router belongs.

Remote AS

The Autonomous System to which your neighboring router belongs.

5. Types of BGP

There are two main types of BGP.

External BGP (eBGP)

eBGP is used to exchange routing information between different Autonomous Systems.

Example: A company exchanging routing information with its Internet Service Provider.

Internal BGP (iBGP)

iBGP is used to exchange routing information between routers within the same Autonomous System.

Example: Multiple routers exchanging BGP routes inside a large enterprise network.

Easy Way to Remember
  • eBGP: Different Autonomous Systems.
  • iBGP: Same Autonomous System.
6. What Is a BGP Neighbor?

A BGP Neighbor is another router with which a router establishes a BGP session to exchange routing information.

Before routers can exchange routes, they must establish a connection.

BGP uses TCP port 179 for communication.

How It Works
  1. Both routers are configured as BGP neighbors.
  2. They establish a TCP connection.
  3. They exchange BGP session information.
  4. The BGP session becomes Established.
  5. Both routers can begin exchanging routing updates.

Important: The BGP neighbor state should be Established for normal route exchange.

7. What Is Route Advertisement?

Route Advertisement is the process of informing neighboring routers about reachable networks.

For example:

Router A informs Router B that it can reach Network A.

Router B informs Router A that it can reach Network B.

Once the routes are accepted and usable, both routers can forward traffic toward the remote networks.

This process is called BGP Route Advertisement.

8. What Is BGP Prefix Filtering?

Prefix Filtering controls which network routes a router accepts or advertises.

It helps administrators control routing information.

Inbound Prefix Filtering

Controls which routes a router accepts from its BGP neighbor.

Simple Meaning: Which network routes am I allowed to learn?

Outbound Prefix Filtering

Controls which routes a router advertises to its BGP neighbor.

Simple Meaning: Which network routes am I allowed to share?

Permit and Deny
  • Permit: Allows matching routes.
  • Deny: Blocks matching routes.

Prefix filtering improves routing control and helps prevent unwanted route exchange.

9. What Is BGP Best Path Selection?

Sometimes a router learns multiple routes to the same destination.

BGP evaluates these routes and selects a preferred path using routing attributes and policies.

Some commonly used factors include:

  • Local Preference
  • AS Path
  • MED
  • Next-Hop Reachability
Simple Example

Imagine a company has connections through two ISPs.

Both ISPs provide routes to a destination.

BGP evaluates the available routes and determines which path should be preferred.

If the preferred path becomes unavailable, another valid route may be selected.

Remember: BGP selects paths based on routing policies and attributes, not simply the fastest connection.

10. Where Is BGP Used?

Internet Service Providers

ISPs use BGP to exchange routing information with other networks.

Enterprise Networks

Large organizations use BGP to connect different network environments.

Multi-ISP Connectivity

Companies use BGP to manage routing through multiple internet providers.

Data Centers

BGP helps exchange routing information in large data center networks.

SD-WAN Networks

BGP can be used to exchange routes between SD-WAN gateways and other routers.

BGP itself does not establish SD-WAN tunnels or encrypt traffic.

11. BGP vs Static Routing

Static Routing

In static routing, administrators manually configure the path to reach a destination network.

It is suitable for small networks with simple routing requirements.

BGP Dynamic Routing

In BGP, routers exchange information about reachable networks.

It is useful when multiple networks, routing policies, or external connections need to be managed.

Key Difference: Static routes are entered manually, while BGP dynamically exchanges routing information with configured neighbors.

12. Important BGP Terms

  • BGP: Protocol used to exchange routing information.
  • Autonomous System: Group of networks under common routing administration.
  • ASN: Number identifying an Autonomous System.
  • BGP Neighbor: Router configured to exchange BGP information.
  • eBGP: BGP between different Autonomous Systems.
  • iBGP: BGP within the same Autonomous System.
  • Route Advertisement: Sharing network reachability information.
  • Inbound Filter: Controls received routes.
  • Outbound Filter: Controls advertised routes.
  • Next Hop: Router used to reach a destination.
  • Best Path: Preferred route selected by BGP.
  • Established: State indicating an operational BGP session.
13. Conclusion

Border Gateway Protocol is a dynamic routing protocol that allows routers to exchange information about reachable networks.

BGP is especially useful in environments where multiple organizations, ISPs, or enterprise networks need to communicate.

For beginners, understanding these five concepts is enough to build a strong foundation:

  1. Autonomous System: Identifies a network administration.
  2. BGP Neighbor: A router that exchanges routing information.
  3. Route Advertisement: Shares information about reachable networks.
  4. Prefix Filtering: Controls which routes are accepted or advertised.
  5. Best Path Selection: Determines the preferred route to a destination.

The most important thing to remember: BGP tells routers which networks are reachable and helps them choose the preferred path to those networks.

What are your feelings

🙂😐🙁