BGP Advanced Configuration — Cisco IOS / IOS-XE
Generate advanced BGP configurations for Cisco IOS/IOS-XE including route reflectors, confederations, route policies, multipath, BFD, and VPNv4.
What is it?
BGP (Border Gateway Protocol, RFC 4271) is the routing protocol of the Internet — the only Exterior Gateway Protocol (EGP) in production use today. Unlike IGPs (OSPF, EIGRP) which route based on metrics, BGP routes based on path attributes (AS-PATH, LOCAL_PREF, MED, COMMUNITIES), giving operators fine-grained policy control over traffic engineering. Cisco IOS/IOS-XE implements the full RFC 4271 feature set plus Cisco-proprietary extensions: Weight (highest priority, local to the router, not in RFC), peer groups for scalable configuration, route reflectors (RFC 4456) for iBGP scalability, confederations (RFC 5065) for very large ASes, and 'fall-over bfd' for sub-second convergence using Bidirectional Forwarding Detection. BGP uses TCP port 179 for reliable session establishment and has no maximum hop count — it is purpose-built for inter-domain routing at Internet scale.
When to use
- ·Connecting to one or more ISPs (always use BGP for multi-homed Internet connectivity)
- ·iBGP within a large enterprise or SP core for scalable route distribution
- ·MPLS VPN PE-CE routing between provider edge and customer edge routers
- ·When you need policy-based path selection (prefer one ISP over another, traffic engineering)
- ·Multi-homing with active-active or active-standby failover to different ISPs
- ·When your AS needs to exchange routing information with external autonomous systems
- ·SD-WAN route exchange between edge devices and controllers
When NOT to use
- ·Small campus or branch LANs with no ISP connection — use OSPF or EIGRP instead
- ·Single-homed sites with one ISP — use a static default route to the ISP
- ·When BGP complexity exceeds the operational benefit for the network size
- ·For routing between VLANs on a single switch — use an SVI with a routing protocol
How it compares
Prerequisites
- →IP reachability to BGP peer must exist — for eBGP this means a direct link; for iBGP an IGP must reach the loopback used as update-source
- →AS numbers assigned — public ASNs from ARIN/RIPE/APNIC for Internet peering, private ASNs 64512-65535 (2-byte) or 4200000000-4294967294 (4-byte) for internal use
- →Route policies (prefix-lists, community-lists, route-maps) should be defined BEFORE applying to neighbors to avoid transient policy gaps
- →For iBGP with route reflectors: understand cluster design and client/non-client topology
- →MTU consistency on BGP peering interfaces (especially important for eBGP over WAN links)
Config Generator
Local AS number. Use 4-byte ASN format: 65000 or 4200000001
Must be unique. Use the loopback0 IP address.
Log BGP neighbor state changes to syslog — strongly recommended
Prevents auto-activation of neighbors in IPv4 AF — best practice for multi-AF deployments
Allow eBGP multipath across different ASes — required for ECMP to multiple upstream ISPs
Compare MED across different ASes — disabled by default, enable with caution in multi-provider environments
Ensure consistent best-path selection regardless of order routes are received
Set only on Route Reflector. Must be unique per RR cluster. Usually set to the RR loopback IP.
External AS number for confederation — the AS presented to the outside world
Space-separated list of confederation member ASes
Keepalive interval. Default 60s. Reduce to 10s for faster detection (with holdtime 30).
Hold time. Default 180s. Must be 3x keepalive. Set to 0 to disable.
Allows BGP sessions to survive a route processor failover (NSF/SSO)
How long to keep stale routes during graceful restart
Suppress flapping routes. Use carefully — can delay convergence. Not recommended for iBGP.
Maximum eBGP equal-cost paths for load balancing. Requires multipath-relax for different ASes.
Maximum iBGP equal-cost paths. Requires route reflector or full mesh.
Verification commands
show ip bgp summaryOverview of all BGP neighbors, their state, and prefix counts
ExpectedState column shows numeric (prefixes received) for established neighbors; 'Idle', 'Active', 'Connect' indicate problems
show ip bgp neighbors X.X.X.XDetailed session info for a specific neighbor: state, timers, capabilities, counters
ExpectedBGP state = Established, version = 4, capabilities should show route-refresh, 4-byte ASN
show ip bgpFull BGP table with all prefixes, next-hops, and path attributes
ExpectedBest paths marked with >, valid paths with *, locally originated with i
show ip bgp X.X.X.XDetailed path information for a specific prefix: all paths, attributes, and best-path decision
ExpectedShows LOCAL_PREF, WEIGHT, AS-PATH, MED, ORIGIN, NEXT_HOP for each path
show ip bgp regexp ^65001_Filter BGP table by AS-PATH regex — show routes learned from AS 65001
ExpectedLists all prefixes with AS-PATH starting with 65001
show ip bgp community 65000:100Filter BGP table by community value
ExpectedLists all prefixes tagged with community 65000:100
show ip bgp neighbors X.X.X.X advertised-routesShow routes being sent to this neighbor after outbound policy
ExpectedList of prefixes this router is advertising to the neighbor
show ip bgp neighbors X.X.X.X received-routesShow all routes received from this neighbor before inbound policy (requires soft-reconfig inbound)
ExpectedRequires 'neighbor X soft-reconfiguration inbound' configured
show ip bgp neighbors X.X.X.X routesShow routes accepted from this neighbor after inbound policy
ExpectedPrefixes that passed inbound policy and are candidates for best-path selection
show ip bgp neighbors X.X.X.X policyShow inbound and outbound policies applied to this neighbor
ExpectedLists route-maps, prefix-lists, filter-lists applied in/out
Debug commands
debug ip bgp X.X.X.X eventsLive BGP session event debugging for a specific neighbor
WarningUse with caution in production. Always run 'undebug all' after. Can generate heavy syslog.
debug ip bgp X.X.X.X updatesDebug BGP UPDATE message processing for a specific neighbor
WarningVery verbose in production. Restrict to specific neighbor IP always.
clear ip bgp X.X.X.X softSoft reset BGP session — re-applies policies without tearing down the TCP session
WarningSafe to run in production. Hard reset ('clear ip bgp X.X.X.X') tears down the session.
clear ip bgp X.X.X.X soft inRe-apply inbound policy without tearing down the session
WarningRequires soft-reconfiguration inbound OR route-refresh capability
Common mistakes & fixes
Further learning
Recommended books to go deeper on this topic.
BGP Design and Implementation
Randy Zhang & Micah Bartell · Cisco Press · The practical BGP bible — iBGP, eBGP, policies, communities, design patterns
Internet Routing Architectures
Sam Halabi · Cisco Press · BGP for ISPs and large enterprise — AS path, route reflectors, confederation