PacketLab
Unit 1 · Introduction to BGP

Introduction to BGP

Start with an Internet connection, add redundancy, and see when exchanging routes with other networks becomes useful.

Why BGP?

One provider: client access

A company connects its private LAN to one ISP. NAT/PAT lets clients share a public address, and a default route sends external traffic to the ISP. The customer does not need BGP for this arrangement.

One customer, one providerIllustrative topology
Single provider connection R1R2 CustomerInternet provider
The solid line is a physical connection. This conceptual diagram does not show an established BGP session.

Public-facing servers

Adding a web or mail server does not automatically change the routing requirement. Port forwarding can expose a service, or the ISP can route an assigned public subnet to the customer. Both can work without customer BGP.

Public services with one providerIllustrative topology
Customer LAN · clients and serversOne ISPR1NAT/PAT or routed subnetR2Internet accessDefault route → ISP
Solid line: provider connection. Clients and services share the customer network. This conceptual view does not prescribe a firewall or server configuration.

Redundancy with one provider

Two customer routers can offer primary and backup exits to the same ISP. Internal routing can prefer the primary default and use the backup after a detected failure. BGP is still not mandatory; failure detection must cover the failures the design intends to survive.

Primary and backup access to one ISPIllustrative topology
Customer · shared internal routingOne provider · one ISPR1Primary exitR2Backup exitR3R4Primary linkBackup linkInternal LAN via either border
Solid lines: network connectivity. The left branch represents shared internal connectivity, not a direct cable between the border routers. Failure detection controls when the backup is used.

A second link does not by itself provide destination-specific exit choices. Equal-cost forwarding also does not guarantee an exact traffic ratio.

Two independent providers

Now the company wants the same public service prefix reachable through either ISP. BGP lets it advertise that authorized prefix to both providers and receive their routes. Policy can select exits and influence how other networks reach it.

A customer with two providersIllustrative topology
Customer · AS 65010ISP-A · AS 65020ISP-B · AS 65030 R1R2R3
Solid lines are physical links; shaded boxes identify ASes. Private AS numbers illustrate a lab, not real Internet assignments.

An address block supplied by one ISP may not be accepted through another. Multihoming needs suitable address space, provider agreements and permitted advertisements; BGP does not make an arbitrary prefix globally usable.

Autonomous systems

An autonomous system (AS) is a group of networks presenting a common routing policy. Its ASN identifies that routing domain, not one router. Our customer and providers use private ASNs 65010, 65020 and 65030 for examples.

TermMeaning
eBGP / iBGPBGP between different ASes / within the same AS.
Two-byte / four-byte ASN16-bit and 32-bit numbering formats; four-byte support expands the number space.
Private ASNs64512–65534 and 4200000000–4294967294; not globally unique.
Public ASNsIn the 16-bit space: 1–64495, excluding 23456 (AS_TRANS). An ASN must be assigned to its operator; numbers in this range are not free to choose. Public assignments also exist in the 32-bit space; consult the registry.
Example: AS15169 (Google). See Google’s network documentation.

An AS may use OSPF or IS-IS for internal reachability. BGP carries reachability and policy between routing domains. Public address space and ASNs are allocated through the Internet registry system; assignment and provider policy determine their permitted use.

BGP advertisements

The customer advertises its service prefix to both providers. In the opposite direction, it can accept defaults, selected routes, or full feeds. BGP does not require a full Internet table.

In the examples below, R1 reaches ISP-A/R2 at 192.0.2.2 and ISP-B/R3 at 192.0.2.6. Sessions are already established. Outputs are illustrative router output excerpts, not recorded lab results.

Default route

Both providers advertise 0.0.0.0/0. R1 selects ISP-A in this example; both candidates remain visible in BGP.

Illustrative output · default-only case
R1# show ip bgp
     Network          Next Hop       Metric LocPrf Weight Path
 *>  0.0.0.0          192.0.2.2           0             0 65020 i
 *                    192.0.2.6           0             0 65030 i

R1# show ip route 203.0.113.10
Routing entry for 0.0.0.0/0, supernet
  Known via "bgp 65010", distance 20, metric 0
  * 192.0.2.2

Suppose 203.0.113.0/24 sits behind ISP-B. With only defaults, R1 still sends that traffic to ISP-A, which may forward it toward ISP-B. Connectivity works, but the exit is indirect.

Partial routes plus a default

ISP-B now also advertises 203.0.113.0/24. R1 keeps its preferred default through ISP-A and gains a specific route through ISP-B.

Illustrative output · after learning the specific prefix
R1# show ip bgp
     Network          Next Hop       Metric LocPrf Weight Path
 *>  0.0.0.0          192.0.2.2           0             0 65020 i
 *                    192.0.2.6           0             0 65030 i
 *>  203.0.113.0/24   192.0.2.6           0             0 65030 i

R1# show ip route 203.0.113.10
Routing entry for 203.0.113.0/24
  Known via "bgp 65010", distance 20, metric 0
  * 192.0.2.6

Forwarding chooses the longer matching prefix. This destination now takes ISP-B; other destinations can still use the default. BGP is not comparing /0 against /24 as competing paths for one prefix.

Full Internet routing table

Full feeds provide routes to many destinations, often with alternatives from each provider. They offer more policy choices but need more memory and processing. They do not guarantee the lowest latency.

FeedVisibilityResource cost
DefaultsGeneral exits only.Smallest route set.
Partial plus defaultSelected destinations and fallback exits.Depends on the selected routes.
Full feedsBroad destination-level choices.More prefixes, paths and updates.

A public looking glass exposes another router’s BGP view. Network entries count prefixes; path entries count alternatives. Counts change over time. The table-reading lesson explores those views.

Path vector

BGP advertises a prefix with attributes, including its AS path. R1 originates 198.51.100.0/24; R4 learns it across R2 and R3.

A prefix across four ASesIllustrative topology
AS 65010R1AS 65020R2AS 65030R3AS 65040R4198.51.100.0/24192.0.2.0/30192.0.2.4/30192.0.2.8/30R3: 192.0.2.9 → R4: 192.0.2.10At R4: AS path 65030 65020 65010
Solid lines: physical connectivity with eBGP sessions. The AS-path label describes the route learned at R4, not a captured packet trace.
Illustrative output · R4
R4# show ip bgp
     Network          Next Hop       Metric LocPrf Weight Path
 *>  198.51.100.0/24  192.0.2.9                         0 65030 65020 65010 i

Read from the advertising neighbor toward the origin: AS 65030, then 65020, then 65010. The final i is an origin code, not an ASN or an iBGP indicator. An ordinary receiver rejects an advertisement containing its own ASN to prevent AS-level loops.

The AS path is routing information, not a list of every physical router traversed by a data packet.

BGP route selection

For the same prefix, BGP compares usable paths using attributes and policy. A preferred provider can be selected before AS-path length is considered, so the shorter AS path does not always win.

Choosing routes by destination can steer traffic between providers, but does not guarantee an exact 80/20 byte split. Traffic volumes vary. Attribute configuration and the full selection sequence belong in later lessons.

Key Takeaways

  • Internet access, public servers and backup links do not automatically require customer BGP.
  • An AS presents a common routing policy; eBGP connects different ASes and iBGP connects routers within one AS.
  • BGP neighbors can supply defaults, selected prefixes or full feeds; choose the detail your design needs.
  • Forwarding follows the longest matching installed prefix; BGP best-path selection compares paths for the same prefix.
  • The AS path records advertised AS-level reachability, while policy influences which usable path is preferred.

Introduction Quiz

Six questions · four options each · select one answer per question. Submit all answers to see your score and explanations.

1. A company needs client Internet access through one ISP. Which statement is correct?
2. Two routers use BGP and both belong to AS 65010. What is their relationship?
3. R1 has a default via ISP-A and 203.0.113.0/24 via ISP-B. Where does traffic to 203.0.113.10 go?
4. Does running BGP with two providers require accepting full Internet feeds?
5. R4 sees AS path 65030 65020 65010 for 198.51.100.0/24. Which AS is the origin in this ordinary AS sequence?
6. Which statement about BGP route selection is correct?
Technical references and example notes

BGP specification · ASN registry · show commands · Router-symbol attribution.

Addresses and private ASNs are examples, not public Internet assignments. Excerpts omit unrelated fields. Session configuration follows in later lessons.