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.
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.
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.
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.
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.
| Term | Meaning |
|---|---|
| eBGP / iBGP | BGP between different ASes / within the same AS. |
| Two-byte / four-byte ASN | 16-bit and 32-bit numbering formats; four-byte support expands the number space. |
| Private ASNs | 64512–65534 and 4200000000–4294967294; not globally unique. |
| Public ASNs | In 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.
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.2Suppose 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.
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.6Forwarding 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.
| Feed | Visibility | Resource cost |
|---|---|---|
| Defaults | General exits only. | Smallest route set. |
| Partial plus default | Selected destinations and fallback exits. | Depends on the selected routes. |
| Full feeds | Broad 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.
R4# show ip bgp
Network Next Hop Metric LocPrf Weight Path
*> 198.51.100.0/24 192.0.2.9 0 65030 65020 65010 iRead 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.
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.