Cisco IOS BGP (eBGP / iBGP)
eBGP and iBGP configuration with route reflectors, communities, prefix-lists, and route-maps for Cisco IOS/IOS-XE.
What is it?
BGP (Border Gateway Protocol) is the routing protocol that runs the internet. It's an Exterior Gateway Protocol (EGP) designed to exchange routing information between different organizations (Autonomous Systems). Every AS on the internet has a unique AS number, and BGP is how they announce which IP prefixes they own. Unlike OSPF which finds the 'shortest' path, BGP uses a complex set of attributes (AS_PATH, LOCAL_PREF, MED, communities) to implement routing policies.
✓ When to use
- ·Connecting to one or more ISPs (internet peering) — always BGP
- ·Multi-homed networks that need traffic engineering across multiple ISPs
- ·Large enterprise networks or data centers that need policy-based routing between different internal domains
- ·SD-WAN overlay routing where BGP carries VPN prefixes between sites
- ·Any time you need to exchange routes with an organization you don't control
✗ When NOT to use
- ·Routing inside your own organization — use OSPF or EIGRP instead (they converge faster)
- ·Small networks with a single ISP — use a default static route (0.0.0.0/0) pointing to the ISP
- ·Networks where you don't need routing policy control — BGP complexity is not worth it
How it compares
Prerequisites
- →Loopback interfaces configured on all routers (used as BGP router IDs)
- →IGP (OSPF or EIGRP) must be running between iBGP neighbors for reachability
- →AS numbers allocated — public AS from ARIN/RIPE if connecting to internet, private AS (64512-65534) for internal BGP
- →For eBGP: physical connectivity to the peer (or single-hop reachability)
- →Prefix-lists and route-maps should be prepared before enabling BGP neighbors
Config Generator
Verification commands
show bgp summaryShow all BGP neighbors and their state
Expected: Neighbors should show 'Established' state and a non-zero 'Up/Down' time. 'Active' or 'Idle' means not connected.
show bgp neighbors <ip>Show detailed BGP session info for a specific neighbor
Expected: Shows hold time, capabilities, messages sent/received, and the reason for last reset
show ip route bgpShow routes learned via BGP in the routing table
Expected: Routes marked 'B' (eBGP) or 'b' (iBGP) with the correct next-hop
show bgp ipv4 unicastShow the BGP table with all paths and best-path selection
Expected: The '>' symbol marks the best path. '* i' means a valid iBGP path not in the routing table.
Debug commands
debug ip bgp <ip> eventsDebug BGP session events with a specific neighbor
⚠ Generates significant output. Use 'undebug all' after. Use in maintenance windows only.
show bgp ipv4 unicast neighbors <ip> advertised-routesShow which routes you are advertising to a neighbor
Common mistakes & fixes
⚡ BGP neighbor stuck in Active state
Cause: TCP port 179 is blocked, wrong peer IP, or wrong remote-as configured
Fix: Verify: 'telnet <peer-ip> 179' from the router. Check ACLs blocking TCP 179. Verify remote-as matches the peer's actual AS number.
⚡ iBGP neighbor established but routes not in routing table
Cause: BGP synchronization rule or next-hop not reachable via IGP
Fix: Add 'no synchronization' (IOS default), and verify the next-hop IP is reachable. Use 'next-hop-self' on route reflectors.
⚡ Routes not being advertised to neighbor
Cause: Route not in the routing table, prefix-list filtering it out, or network statement with wrong mask
Fix: Verify 'show ip route <network>' exists. Check 'show bgp neighbors <ip> advertised-routes' vs 'show bgp neighbors <ip> routes'.
⚡ BGP session flapping frequently
Cause: Hold timer expiry due to high CPU or interface instability
Fix: Check CPU: 'show processes cpu sorted'. Increase hold timers: 'neighbor <ip> timers 10 30'. Check interface stability.