What Is BGP and How Does Internet Routing Work?

What Is BGP and How Does Internet Routing Work?
Networking ATN Campus September 24, 2026 35 views

What Is BGP and How Does Internet Routing Work?

BGP (Border Gateway Protocol) is the routing protocol that plays a central role in exchanging reachability information between different networks across the Internet.

While protocols such as OSPF are commonly used inside an organization, BGP is designed to exchange routing information between Autonomous Systems (AS). Internet service providers, large enterprises, cloud providers, and other networks use BGP to communicate which IP prefixes they can reach.

In this guide, we will learn what BGP is, what Autonomous Systems are, how BGP peers exchange routes, the difference between eBGP and iBGP, important BGP attributes, how BGP makes routing decisions, and how Internet routing works at a high level.

```

What Is BGP?

```

BGP stands for Border Gateway Protocol. It is a path-vector routing protocol used to exchange network reachability information between Autonomous Systems.

BGP is different from an internal routing protocol such as OSPF. OSPF is primarily concerned with finding paths inside an organization, while BGP is designed to exchange routes between independently administered networks.

         INTERNET

   +----------------+
   |    ISP / AS 1  |
   +----------------+
          |
         BGP
          |
   +----------------+
   |    ISP / AS 2  |
   +----------------+
          |
         BGP
          |
   +----------------+
   | Enterprise AS  |
   +----------------+
```

What Is an Autonomous System?

```

An Autonomous System (AS) is a collection of IP networks and routers under a common routing administration and policy.

Each public Autonomous System is identified using an Autonomous System Number (ASN).

    AS 65001
    ISP A
       |
       | BGP
       |
    AS 65002
    ISP B
       |
       | BGP
       |
    AS 65003
    Company C

ASNs are important because BGP uses them to identify the path that routes have travelled through different Autonomous Systems.

```

What Is an IP Prefix?

```

A prefix represents an IP network and its prefix length. For example:

    203.0.113.0/24

    Network:       203.0.113.0
    Prefix Length: /24

BGP exchanges reachability information for prefixes rather than individual host addresses in the way a user might think of them.

For example, an ISP may advertise that it can reach:

    203.0.113.0/24
```

How Does BGP Work?

```

At a high level, BGP works by establishing a session between BGP speakers and exchanging routing information.

  1. Two routers establish a BGP session.
  2. The routers exchange information about reachable prefixes.
  3. BGP stores received routes in its BGP routing information.
  4. BGP evaluates attributes and path information.
  5. A selected route may be installed into the routing table.
  6. The router can advertise selected routes to other BGP peers.
    BGP Peer Relationship
             |
             v
    Exchange Prefixes
             |
             v
    BGP Routing Information
             |
             v
    Path Selection
             |
             v
    Best BGP Path
             |
             v
    Routing Table
```

What Is a BGP Peer?

```

A BGP peer, also called a BGP neighbor, is another router with which a BGP session is established.

    Router A                         Router B
   +---------+                     +---------+
   | BGP AS1 |---------------------| BGP AS2 |
   +---------+        BGP          +---------+

BGP peers establish a TCP connection and then exchange BGP messages.

BGP uses TCP port 179 for its sessions.

```

eBGP vs iBGP

```

BGP sessions are commonly divided into two categories: eBGP and iBGP.

Feature eBGP iBGP
Meaning External BGP Internal BGP
Used between Different ASes Routers within the same AS
Main purpose Exchange routes between ASes Distribute BGP routes inside an AS
Example AS 65001 ↔ AS 65002 AS 65001 ↔ AS 65001
```

How Internet Routing Works

```

The Internet is made up of thousands of independently operated networks. BGP allows these networks to exchange reachability information.

      AS 100
    ISP / Network A
         |
         | BGP
         |
      AS 200
    ISP / Network B
         |
         | BGP
         |
      AS 300
    ISP / Network C
         |
         |
    Destination
    203.0.113.0/24

Suppose AS 300 owns or originates the prefix 203.0.113.0/24. It can advertise that prefix to another network using BGP.

Other networks can then learn a path toward that prefix and may advertise the reachability information further.

```

What Is AS_PATH?

```

One of the most important BGP attributes is AS_PATH.

AS_PATH records the sequence of Autonomous Systems through which a BGP route has been advertised.

    Destination Prefix
    203.0.113.0/24

    AS_PATH:

    65030 65020 65010

The AS_PATH helps BGP understand the path toward a destination and provides an important mechanism for preventing routing loops between Autonomous Systems.

In simplified path-selection discussions, a shorter AS_PATH can be preferred, but BGP's complete decision process depends on multiple attributes and implementation rules.

```

Important BGP Attributes

```
Attribute Purpose
AS_PATH Shows the AS path toward a destination.
LOCAL_PREF Helps select preferred outbound paths within an AS.
MED Can provide a neighboring AS with information about preferred entry points.
NEXT_HOP Identifies the next-hop information for reaching the prefix.
COMMUNITY Allows routes to be grouped and policies to be applied.
```

How Does BGP Choose a Route?

```

BGP does not simply choose a route based on the shortest physical distance.

BGP uses routing attributes and policy to determine which available path is preferred. The exact best-path process depends on the implementation and configuration.

    Multiple Routes
          |
          v
    Apply BGP Policy
          |
          v
    Compare Attributes
          |
          v
    Select Best Path
          |
          v
    Install / Advertise

This policy-driven behavior is one reason BGP is suitable for large-scale Internet routing.

```

BGP Routing Example

```
              Internet
                 |
              AS 100
             /      \
            /        \
         AS 200     AS 300
            \        /
             \      /
              AS 400
                 |
          203.0.113.0/24

AS 100 may learn more than one path toward the same destination prefix. BGP can compare those paths using configured policies and attributes.

The selected path becomes the preferred BGP path, subject to the routing table installation rules of the platform.

```

Basic Cisco BGP Configuration

```

A simple example of configuring BGP on a Cisco router is shown below. Exact syntax and behavior can vary by platform and IOS version.

Router R1

```

Router(config)# router bgp 65001
Router(config-router)# neighbor 10.0.12.2 remote-as 65002
Router(config-router)# network 192.168.10.0 mask 255.255.255.0 
```

Router R2

```

Router(config)# router bgp 65002
Router(config-router)# neighbor 10.0.12.1 remote-as 65001
Router(config-router)# network 192.168.20.0 mask 255.255.255.0 
```

The remote-as command identifies the AS of the BGP neighbor. The network statement identifies a prefix that the router intends to advertise, subject to the platform's requirements for that route to exist in the routing table.

```

Verifying BGP

```

Check BGP Neighbors

```

Router# show ip bgp summary 
```

View the BGP Table

```

Router# show ip bgp 
```

View a Specific Prefix

```

Router# show ip bgp 203.0.113.0 
```

Check the Routing Table

```

Router# show ip route 

BGP Table vs Routing Table

```

A router can learn multiple BGP paths for the same destination. The BGP table contains BGP path information, while the main routing table contains routes selected for forwarding.

    BGP Routes
         |
         v
    BGP Best Path
         |
         v
    Main Routing Table
         |
         v
    Forward Packets
```

Why Is BGP Important?

```
  • Connects independently administered networks.
  • Supports large-scale Internet routing.
  • Allows routing policies to influence path selection.
  • Supports multiple paths toward destinations.
  • Allows organizations and providers to advertise prefixes.
  • Provides mechanisms for routing policy and path control.
```

Common BGP Problems

```

1. BGP Neighbor Is Not Established

Check:

  • IP connectivity between peers.
  • Correct neighbor IP address.
  • Correct remote AS number.
  • TCP port 179 reachability.
  • Firewall or ACL rules.
  • BGP configuration.

2. Prefix Is Not Being Advertised

  • Check the BGP network statement.
  • Check whether the prefix exists in the routing table.
  • Check route policies and filters.
  • Check the BGP table.

3. Unexpected BGP Path

  • Check LOCAL_PREF.
  • Check AS_PATH.
  • Check MED where applicable.
  • Check route policies.
  • Check the next-hop information.
```

Practical BGP Lab

```

Build a small multi-AS topology using Cisco Packet Tracer where supported, or use GNS3/EVE-NG for a more realistic BGP lab.

   AS 65001
      R1
       |
       | BGP
       |
      R2
   AS 65002
       |
       | BGP
       |
      R3
   AS 65003

 R3 advertises:

 203.0.113.0/24

Lab Objectives

  1. Configure IP connectivity.
  2. Configure different AS numbers.
  3. Establish eBGP neighbors.
  4. Advertise a network prefix.
  5. Verify the BGP session.
  6. Inspect the BGP table.
  7. Inspect the routing table.
  8. Observe the AS_PATH.
  9. Test end-to-end connectivity.
```

Quick BGP Quiz

```

1. What does BGP stand for?

Show Answer

Border Gateway Protocol.

2. What is an Autonomous System?

Show Answer

A collection of IP networks and routers under a common routing administration and policy.

3. What is the difference between eBGP and iBGP?

Show Answer

eBGP is used between different Autonomous Systems, while iBGP operates between BGP routers within the same Autonomous System.

4. Which TCP port does BGP use?

Show Answer

TCP port 179.

```

Key Takeaways

```
  • BGP is a major routing protocol used between Autonomous Systems.
  • The Internet is made up of many independently operated networks.
  • BGP exchanges reachability information for IP prefixes.
  • AS_PATH records Autonomous Systems in the advertised path.
  • eBGP operates between different ASes.
  • iBGP operates within an AS.
  • BGP uses attributes and policy for path selection.
  • BGP uses TCP port 179.
  • BGP is fundamental to understanding Internet routing.
```
```

Want to Learn BGP and Advanced Networking? Visit ATN Campus

Want to learn BGP, OSPF, routing, switching, subnetting, network security, and Internet routing through practical training?

Visit ATN Campus and build your networking knowledge through theory, practical hands-on labs, Cisco-based exercises, and real-world networking scenarios.

Learn More Than Just BGP

  • CCNA – Cisco Certified Network Associate
  • CCNP – Cisco Certified Network Professional
  • BGP & Advanced Routing
  • OSPF & Dynamic Routing
  • Routing & Switching
  • Subnetting & IP Addressing
  • Network Security
  • CEH – Certified Ethical Hacker
  • Cisco CyberOps
  • Cloud Networking
  • Python for Network Automation
  • Practical Cisco Networking Labs

Whether you are a beginner or preparing for professional networking certifications, ATN Campus helps you move from networking theory to practical hands-on skills.

???? Want to learn networking? Visit ATN Campus.

???? Learn Networking. ???? Understand Internet Routing. ???? Master Routing & Switching. ???? Practice with Real Labs. ???? Prepare for Certifications. ???? Build Your IT Career with ATN Campus.
Document ATN CAMPUS