CJCCIE Journals
Home › BGP

BGP Cheat Sheet: Best Path Order, States, Attributes and Commands

BGPCheat Sheets CCIE journals · November 27, 2026

Everything you need to answer "why did BGP choose that path?" on one page.

Essentials

ItemValue
TransportTCP port 179
Administrative distanceeBGP 20, iBGP 200
TimersKeepalive 60 seconds, hold 180 seconds (defaults)
Private AS numbers64512 to 65534, and 4200000000 to 4294967294
eBGP TTL1 by default; loopback peering needs multihop
iBGP ruleA route learned from an iBGP peer is not passed to another iBGP peer

Best path selection (in order)

  1. Weight, highest (local to the router)
  2. Local preference, highest
  3. Locally originated routes
  4. AS path, shortest
  5. Origin: IGP, then EGP, then incomplete
  6. MED, lowest
  7. eBGP over iBGP
  8. IGP metric to the next hop, lowest
  9. Oldest eBGP path
  10. Lowest router ID
  11. Lowest neighbour address

Before any of this, the route must be valid: the next hop has to be reachable.

Neighbour states

StateMeaning
IdleNot trying, or waiting to retry
ConnectWaiting for the TCP connection
ActiveTCP attempt failed, trying again. Not a healthy state.
OpenSentOPEN sent, waiting for the peer OPEN
OpenConfirmWaiting for the first keepalive
EstablishedUp. Routes are exchanged.

Stuck in Active or Connect: check reachability to the peer address, update source, TCP 179 filtering, multihop. Flapping between OpenSent and Idle: AS number, authentication or capability mismatch.

Traffic engineering

GoalTools
Control how traffic leaves youLocal preference (whole AS), weight (one router)
Influence how traffic reaches youAS-path prepending, MED, more-specific prefixes, provider communities

Attributes

CategoryExamples
Well-known mandatoryAS path, next hop, origin
Well-known discretionaryLocal preference, atomic aggregate
Optional transitiveCommunities, aggregator
Optional non-transitiveMED, originator ID, cluster list

Commands

CommandShows
show ip bgp summaryPeers, state, prefixes received
show ip bgpThe BGP table; > marks the best path
show ip bgp <prefix>All paths for a prefix and why one won
show ip bgp neighbors <ip> advertised-routesWhat you send to a peer
show ip bgp neighbors <ip> routesWhat you accepted from a peer
clear ip bgp <ip> softRe-apply policy without dropping the session

Well-known communities

  • no-export: do not send outside the AS.
  • no-advertise: do not send to any peer.
  • local-AS: keep inside the local sub-AS.

CCIE Journals cheat sheet. Free to print and share for study.

CJ

Written by CCIE journals

Network security engineer sharing hands-on notes from the journey to CCIE.

0 Comments

Post a Comment

Ready to level up your networking career?

Meet the Author →

Welcome to my blog, dedicated to network and security engineering enthusiasts. Here, you can learn about various vendors and gain valuable insights and resources to excel in the field of network engineering!