Skip to content

ENCOR course / Control the BGP path · Step 1 of 4

Guide: BGPSwitch

Guide

BGP: neighbors, attributes and best path selection (CCNP ENCOR)

BGP exchanges reachability between autonomous systems and applies ordered policy to choose routes. This guide covers the BGP neighbor, attributes and forwarding behaviors tested in the associated ENCOR questions.

5 parts · video · 18 practice questions

BGP best-path order and route attributes

For valid paths to the same prefix, Cisco IOS XE prefers higher Weight, then higher Local Preference, then a route originated by the local BGP process, then the shorter AS_PATH, then the lower origin code (IGP before EGP before Incomplete), and then the lower MED when the comparison applies. If Weight and Local Preference tie, local origination is evaluated before AS_PATH length. These are successive tie breakers: a difference in a higher ranked criterion decides before a lower ranked one.

Weight default for received paths
0
Weight for locally originated routes
32768
Local Preference default
100
BGP administrative distance
20 for eBGP and 200 for iBGP

Weight is Cisco-specific and local to one router; it is not sent to any BGP neighbor. Higher values win. Its default is 0 for received paths, while locally originated routes normally have Weight 32768. Local Preference is exchanged among iBGP speakers in the same AS, is not sent to eBGP peers, and defaults to 100 when absent. Higher Local Preference chooses the preferred exit for traffic leaving the AS.

MED is an optional non-transitive attribute used to suggest which entry point another AS should use to reach the advertising AS. Lower MED wins, but by default IOS XE compares MED only among paths learned from the same neighboring AS. The origin code records how BGP learned the route: a BGP network route has IGP origin, routes distributed from EGP have EGP origin, and routes redistributed from other protocols have Incomplete origin. BGP administrative distance is separate from best path attributes: the defaults are 20 for eBGP and 200 for iBGP. AD decides which routing source is installed for a prefix, not which BGP path wins.

IOS XE
show ip bgp
show ip route
router bgp 65001
 distance bgp 20 200 200
Practice this part:CCNP ENCOR: BGP (18)
References (3)

BGP neighbor states and OpenSent

BGP uses a TCP connection between peers. Connect is part of TCP session establishment. After TCP succeeds, the router sends its BGP OPEN message and enters OpenSent, where it can receive the peer's OPEN. After receiving the peer's OPEN, it waits in OpenReceive for the peer's initial KEEPALIVE, then enters Established and exchanges updates.

A BGP session reaching Established, as a 16 second clip. Watch on its own page
IOS XE
show ip bgp summary
References (1)

iBGP split horizon and route-reflector loop prevention

Ordinary iBGP speakers do not advertise a route learned from one iBGP peer to another iBGP peer. Because iBGP does not add the local AS to AS_PATH for internal advertisements, this split horizon rule prevents loops and requires a full mesh unless the AS uses route reflectors or confederations.

Route origin identifier
ORIGINATOR_ID
Route-reflection list
CLUSTER_LIST
Local cluster ID example
10.0.0.1

A route reflector relaxes that rule for configured clients. When reflecting a route, it adds ORIGINATOR_ID, which identifies the route's originating router, and appends the local cluster ID to CLUSTER_LIST. A router ignores a route if its own router ID appears as ORIGINATOR_ID; a route reflector ignores it if its local cluster ID is already in CLUSTER_LIST. These attributes prevent loops within route reflection. ORIGINATOR_ID is added by the route reflector when it reflects the route.

IOS XE
router bgp 65001
 neighbor 192.0.2.2 route-reflector-client
 bgp cluster-id 10.0.0.1
show ip bgp
References (2)

BGP communities and AS_PATH prepending

The well-known no-export community tells a BGP speaker not to advertise the tagged route to eBGP peers. no-advertise is stricter: do not advertise the route to any BGP peer, internal or external. These communities control propagation; they do not by themselves remove a route from the local BGP table or prevent its use for forwarding.

Well-known community
no-export
Stricter well-known community
no-advertise
Community exchange
not enabled by default

AS_PATH prepending adds extra copies of an AS number to the AS_PATH in an advertised route. A neighboring AS sees a longer path, which can influence inbound traffic toward your AS, but its own routing policy determines the path it selects. On IOS XE, a route map can set a community or prepend an AS path. Community exchange is not enabled by default, so configure it for the neighbor when needed.

IOS XE
route-map OUTBOUND permit 10
 set as-path prepend 65001 65001 65001
 set community no-export
router bgp 65001
 neighbor 192.0.2.2 send-community
 neighbor 192.0.2.2 route-map OUTBOUND out
References (3)

PBR next hop versus default next hop

Policy based routing (PBR) applies a route map policy to matching packets. set ip next-hop specifies where matching packets are sent. set ip default next-hop specifies where matching packets are sent only when there is no explicit route to the destination. The distinction is lookup order; default does not mean that it ignores the routing table.

IOS XE
route-map PBR-NEXT permit 10
 set ip next-hop 192.0.2.1
! Alternative route-map policy
route-map PBR-DEFAULT permit 10
 set ip default next-hop 192.0.2.2
interface GigabitEthernet0/0
 ip policy route-map PBR-DEFAULT
References (1)

Check your understanding

BGP: neighbors, attributes and best path selection (CCNP ENCOR)

All 5 sections · no timer

Unlimited retries

Questions from every section are combined into one assessment. Answer them all correctly to complete the article.

Your completion saves in this browser. Sign in to sync it to your account.