Autonomous Systems
The Foundation of BGP
Autonomous Systems (AS) are the fundamental building blocks of BGP and the Internet. Understanding AS concepts is crucial for BGP mastery.
What is an Autonomous System?
An Autonomous System (AS) is a collection of IP networks and routers under the control of a single administrative entity that presents a common, clearly defined routing policy to the Internet.
Key Characteristics
- Single Administration: Managed by one organization
- Unified Policy: Common routing policy to external networks
- Unique Identifier: Each AS has a unique AS number
- Internal Connectivity: All networks within the AS are reachable
AS Number (ASN) Allocation
AS numbers are managed by Regional Internet Registries (RIRs) and assigned to organizations that need to connect to the Internet with their own routing policy.
AS Number Range | Type | Usage | Availability |
---|---|---|---|
1 - 64511 | 16-bit Public | Internet routing | Limited, carefully allocated |
64512 - 65534 | 16-bit Private | Internal use only | Free for private use |
65535 | Reserved | Special use | Not available |
65536 - 4199999999 | 32-bit Public | Internet routing | Abundant, modern standard |
4200000000 - 4294967294 | 32-bit Private | Internal use only | Free for private use |
Types of Autonomous Systems
Characteristics:
- Single connection to Internet
- No transit traffic
- Default route only
Example: Small enterprise
Characteristics:
- Multiple ISP connections
- No transit traffic
- Receives partial/full routes
Example: Large enterprise
Characteristics:
- Multiple connections
- Carries transit traffic
- Full Internet routes
Example: ISP
Internet Hierarchy
The Internet is structured in a hierarchical manner with different tiers of ISPs:
Internet Hierarchy Structure
Tier 1 ISPs
Tier 2 ISPs
Tier 3 ISPs / Enterprises
Tier Classification
Characteristics:
- Settlement-free peering
- No upstream providers
- Global reach
- Large backbone networks
Count: ~12-15 worldwide
Characteristics:
- Purchase transit from Tier 1
- Peer with other Tier 2
- Regional/national coverage
- Mix of peering and transit
Count: Hundreds worldwide
Characteristics:
- Purchase all transit
- Local/regional focus
- Serve end customers
- Limited peering
Count: Thousands worldwide
AS Relationships
Different types of relationships exist between autonomous systems:
Relationship | Description | Traffic Flow | Financial Model |
---|---|---|---|
Customer-Provider | Customer pays provider for Internet access | Customer → Provider → Internet | Customer pays provider |
Peer-to-Peer | Mutual exchange of traffic | Bidirectional, balanced | Settlement-free |
Sibling | Same organization, different ASes | Free exchange | No charges |
BGP Communities and AS Relationships
BGP communities are often used to signal AS relationships and implement policies:
Common Community Values
- No-Export (65535:65281): Don't advertise to eBGP peers
- No-Advertise (65535:65282): Don't advertise to any peer
- Local-AS (65535:65283): Don't advertise outside local AS
- Custom Communities: Provider-specific policy tags
AS Path Attributes
The AS path is fundamental to BGP operation and shows the sequence of ASes a route has traversed:
AS Path Examples
# Simple AS path
Network: 192.0.2.0/24
AS Path: 65001 65002 65003
Origin: AS 65003
# AS path with prepending
Network: 192.0.2.0/24
AS Path: 65001 65002 65002 65002 65003
Origin: AS 65003 (prepended for traffic engineering)
# AS path with AS set
Network: 192.0.2.0/24
AS Path: 65001 {65002,65003} 65004
Origin: Aggregated from multiple sources
Private AS Numbers
Private AS Considerations
Private AS numbers should be removed before advertising to the Internet:
- 16-bit Private: 64512-65534
- 32-bit Private: 4200000000-4294967294
- Removal: Use "remove-private-as" command
- Replacement: ISP AS number replaces private AS
BGP Speakers
The Participants in BGP
BGP speakers are the routers that participate in BGP routing. Understanding their roles and relationships is essential for BGP network design.
What is a BGP Speaker?
A BGP speaker is a router that implements the BGP protocol and can exchange routing information with other BGP speakers. It maintains BGP sessions, processes routing updates, and makes routing decisions based on BGP attributes.
Core Functions
Session Management
Establish and maintain BGP sessions with neighbors using TCP connections.
Route Processing
Receive, process, and advertise routing information according to configured policies.
Policy Implementation
Apply routing policies for import, export, and path selection decisions.
Path Selection
Choose the best path to destinations using BGP's path selection algorithm.
Types of BGP Speakers
Based on AS Relationship
Definition: BGP speaker that peers with routers in different autonomous systems
Characteristics:
- Usually directly connected
- TTL = 1 by default
- Administrative distance = 20
- Next-hop is typically changed
Definition: BGP speaker that peers with routers in the same autonomous system
Characteristics:
- May be multi-hop
- TTL = 255 by default
- Administrative distance = 200
- Next-hop is typically preserved
BGP Speaker Configuration
Basic BGP Speaker Setup
Basic Configuration
# Configure BGP speaker
router bgp 65001
bgp router-id 1.1.1.1
bgp log-neighbor-changes
# eBGP neighbor
neighbor 203.0.113.1 remote-as 65002
neighbor 203.0.113.1 description "eBGP to ISP"
# iBGP neighbor
neighbor 192.168.1.2 remote-as 65001
neighbor 192.168.1.2 description "iBGP peer"
neighbor 192.168.1.2 update-source loopback0
neighbor 192.168.1.2 next-hop-self
BGP Session Types
Understanding BGP Sessions
BGP sessions are the foundation of BGP communication. Understanding different session types and their characteristics is crucial for proper BGP implementation.
BGP Session Fundamentals
A BGP session is a TCP connection between two BGP speakers that exchange routing information. Each session is characterized by its relationship type, configuration, and operational parameters.
Session Establishment Process
External BGP (eBGP) Sessions
eBGP sessions connect BGP speakers in different autonomous systems. These sessions are typically used for inter-domain routing.
- AS Numbers: Different for each peer
- Administrative Distance: 20
- TTL: 1 (directly connected)
- Next-hop: Changed to advertising router
- AS Path: Prepended with local AS
router bgp 65001
neighbor 203.0.113.1 remote-as 65002
neighbor 203.0.113.1 description "eBGP to ISP"
neighbor 203.0.113.1 password secretkey
network 192.168.1.0 mask 255.255.255.0
Internal BGP (iBGP) Sessions
iBGP sessions connect BGP speakers within the same autonomous system. These sessions distribute externally learned routes throughout the AS.
- AS Numbers: Same for all peers
- Administrative Distance: 200
- TTL: 255 (may be multi-hop)
- Next-hop: Typically preserved
- AS Path: Not modified
- Split Horizon: Routes from iBGP not advertised to iBGP
- Synchronization: iBGP routes need IGP support
- Next-hop Reachability: Must be reachable via IGP
- Full Mesh: Traditionally required
Path Vector Algorithm
The Heart of BGP
The path vector algorithm is what makes BGP unique among routing protocols. It maintains complete path information to prevent loops and enable sophisticated policy control.
What is Path Vector?
Path vector is a routing algorithm that maintains the complete path to each destination. Unlike distance vector protocols that only know the distance and next hop, path vector protocols maintain the entire sequence of autonomous systems a route has traversed.
Key Concepts
Path Information
Each route includes the complete AS path, showing every AS the route has passed through.
AS Path: 65001 65002 65003
Loop Prevention
If a router sees its own AS in the path, it rejects the route, preventing loops.
Rejected: 65001 65002 65001
Algorithm Comparison
Algorithm | Information Maintained | Loop Prevention | Scalability | Policy Control |
---|---|---|---|---|
Distance Vector | Distance + Next Hop | Split Horizon, Poison Reverse | Limited | Minimal |
Link State | Complete Topology | SPF Algorithm | Good | Limited |
Path Vector | Complete Path | AS Path Loop Detection | Excellent | Extensive |
BGP States
BGP Session Lifecycle
BGP sessions progress through a defined set of states during establishment and maintenance. Understanding these states is crucial for troubleshooting BGP issues.
BGP Finite State Machine
BGP operates as a finite state machine (FSM) with six defined states. Each state represents a specific phase in the BGP session lifecycle.
BGP State Descriptions
1. Idle State
Description: Initial state where BGP waits for a start event.
Characteristics:
- No resources allocated
- No TCP connection attempted
- Waiting for manual or automatic start
- ConnectRetry timer not running
6. Established State
Description: BGP session fully established, exchanging routes.
Characteristics:
- Session fully operational
- Route exchange in progress
- Keepalive messages sent periodically
- Hold timer reset on each message
BGP Timers
Various timers control BGP state transitions:
Timer | Default Value | Purpose | States Used |
---|---|---|---|
ConnectRetry Timer | 120 seconds | Time between connection attempts | Connect, Active |
Hold Timer | 180 seconds | Maximum time between messages | OpenSent, OpenConfirm, Established |
Keepalive Timer | 60 seconds | Keepalive transmission interval | OpenConfirm, Established |