BGP is a path-vector routing protocol used between autonomous systems to select routes based on policies rather than shortest path.

Facts

Point Detail
Type Path vector → best-path selection (attributes)
“Advertisements” NLRI (Network Layer Reachability Information) + path attributes in UPDATE messages (AS-PATH, NEXT-HOP, LOCAL_PREF, MED)
Protocol TCP port 179 (reliable session)
AD eBGP 20 · iBGP 200 (typical Cisco)
Transport Unicast TCP session between peers – no multicast
Peering Must be configured manually (no auto discovery)
Timers Keepalive 60 s · Hold 180 s
Message types OPEN, UPDATE, NOTIFICATION, KEEPALIVE
eBGP TTL 1 (direct peers)
Typical use Inter-domain routing + policy-based routing

BGP between autonomous systems

BGP exchanges NLRI (prefixes) between ASes over TCP 179. Routes are evaluated via path attributes (e.g. AS-PATH, LOCAL_PREF) instead of shortest path; the best route is selected by policy/attribute and installed in the routing table.

Private ASN ranges: RFC 1930 defined 64,512–65,635; RFC 6996 changed the 16-bit private range to 64,512–65,534. RFC 7300: the last ASNs (65,535 and 4,294,967,295) should not be used.

Best-path selection

BGP best-path attribute comparison

BGP session states

BGP peering setup

BGP UPDATE exchange

BGP path selection

BGP policy flow

Summarization / aggregation (classic CCNP)

BGP summarization scenario

You own AS 65010 with prefixes 10.10.0.0/24, 10.10.1.0/24, 10.10.2.0/24, 10.10.3.0/24, currently advertised individually to an eBGP neighbor (ISP). Goal: advertise one route: 10.10.0.0/22.

Before summarization BGP advertises all four /24s – bigger tables, more path exploration, unnecessary complexity for the ISP.

router bgp 65010
 aggregate-address 10.10.0.0 255.255.252.0 summary-only

BGP forms 10.10.0.0/22, hides the four /24s and only advertises the summary. Verify with show ip bgp and show ip bgp neighbors <ISP-IP> advertised-routes.

⚠️ Important CCNP trap: blackholing

If one of the /24s disappears internally (e.g. 10.10.2.0/24 DOWN), BGP still advertises the /22 → traffic to 10.10.2.0/24 is blackholed.

router bgp 65010
 aggregate-address 10.10.0.0 255.255.252.0 as-set summary-only

The AS-path contains the original ASes, loop detection is preserved – preferred in multihomed designs.

Configuration

router bgp <ASN>                     ! start the BGP process
neighbor <IP> remote-as <ASN>      ! define a neighbor and its AS
bgp log-neighbor-changes           ! log neighbor up/down (great for troubleshooting)

network 10.0.0.0 mask 255.255.255.0   ! ⚠️ the network MUST exist in the routing table

address-family ipv4
 neighbor <IP> activate
 exit-address-family

Attributes & policy with route-maps:

neighbor <IP> route-map NAME in
neighbor <IP> route-map NAME out
set local-preference <VALUE>        ! influences outbound traffic (higher = better)
set as-path prepend <ASN> <ASN>     ! makes a route less attractive to other ASes
set community <COMMUNITY>

Verification & troubleshooting

show ip bgp                 ! the whole BGP table
show ip bgp summary         ! must-know: neighbors, state, prefixes
show ip bgp neighbor        ! detailed peer info
show ip route bgp           ! BGP routes installed in the routing table
show ip bgp neighbors <IP> received-routes
show ip bgp neighbors <IP> advertised-routes
clear ip bgp <IP>           ! resets the session – use with care
clear ip bgp * soft         ! without soft, the TCP handshake is also reset