BGP Basics for CCNP: eBGP, iBGP and Path Selection

CCNP 9 min readPublished 23 August 2026

Quick answer

Learn BGP fundamentals for CCNP, including eBGP, iBGP, attributes, path selection, Cisco IOS configuration and practical troubleshooting.

Border Gateway Protocol becomes easier to understand when you separate three ideas: how routers form BGP sessions, how routes move between autonomous systems, and how BGP selects a preferred path. This guide explains these BGP basics for CCNP students through a practical Cisco IOS lab.

Before studying BGP, you should be comfortable with IP routing, subnetting and basic Cisco IOS verification. Students who need that foundation can begin with the CCNA course, while engineers preparing for enterprise-level routing can explore the CCNP Enterprise course.

What Is BGP and Why Is It Used?

BGP is a path-vector routing protocol used to exchange network reachability information between autonomous systems. Unlike an interior gateway protocol such as OSPF, BGP is designed for policy control, Internet-scale routing and selecting paths based on attributes rather than bandwidth alone.

An autonomous system, or AS, is a group of networks managed under a common routing policy. Each public AS uses a registered Autonomous System Number, while private labs commonly use AS numbers from the private ranges, including 64512–65534.

BGP uses TCP port 179. Because TCP provides reliable delivery, BGP does not need to implement its own acknowledgement and retransmission system for routing updates.

Diagram in words

Imagine three enterprise routers arranged from left to right:

LAN-A -- R1 (AS 65001) -- R2 (AS 65002) -- R3 (AS 65002) -- LAN-B
           eBGP session       iBGP session

R1 and R2 belong to different autonomous systems, so they use eBGP. R2 and R3 belong to the same autonomous system, so they use iBGP.

What Is the Difference Between eBGP and iBGP?

eBGP exchanges routes between different autonomous systems, while iBGP distributes BGP routes inside the same autonomous system. They use the same BGP protocol but apply different rules to next hops, AS paths, session design and route advertisement.

FeatureeBGPiBGP
Peer autonomous systemDifferent ASSame AS
Common purposeExchange routes between organisations or providersCarry external routes through one AS
Default Cisco administrative distance20200
AS_PATH updateAdds the local AS when advertisingDoes not add the local AS
Default next-hop behaviourChanges next hop when advertisingUsually preserves the existing next hop
Default peer reachabilityCommonly directly connectedCan use loopbacks and multihop IP reachability
Advertisement ruleCan advertise eligible routes to other peersDoes not advertise an iBGP-learned route to another iBGP peer

Administrative distance is used when the router compares routes learned from different routing sources for installation in the routing table. It is not a BGP attribute and does not decide which of several BGP paths becomes the BGP best path.

Why does iBGP need a full mesh?

An iBGP router does not advertise a route learned from one iBGP neighbor to another iBGP neighbor. This loop-prevention rule means that a traditional iBGP design requires every BGP router in the AS to peer with every other BGP router.

A full mesh becomes difficult to maintain as the number of routers grows. Larger networks therefore use route reflectors or, less commonly, BGP confederations to reduce the number of sessions.

How Does a BGP Neighbor Session Form?

Two BGP routers must have IP connectivity, matching neighbor definitions and compatible AS settings before they can exchange routes. The routers then move through the BGP finite-state machine until the session reaches the Established state.

StateMeaning
IdleBGP is waiting to start or has encountered a configuration problem
ConnectThe router is waiting for the TCP connection to complete
ActiveThe TCP connection failed and BGP is trying again
OpenSentA BGP OPEN message has been sent
OpenConfirmThe router is waiting for a KEEPALIVE message
EstablishedThe peers can exchange BGP routes

The Active state does not mean that the session is working. A neighbor repeatedly moving between Idle, Connect and Active usually indicates an IP reachability, TCP port 179, source address or AS number problem.

Which BGP Attributes Should CCNP Students Know?

BGP attributes describe characteristics of a route and allow administrators to implement routing policy. The most important attributes for CCNP-level study are WEIGHT, LOCAL_PREF, AS_PATH, ORIGIN, MED and NEXT_HOP.

AttributeScope and purposePreferred value
WEIGHTCisco-specific value local to one router; not advertisedHighest
LOCAL_PREFShared within an AS; selects the preferred outbound exitHighest
AS_PATHLists autonomous systems crossed by the routeShortest
ORIGINShows how the prefix entered BGP: IGP, EGP or incompleteIGP over EGP over incomplete
MEDSuggests a preferred entry point into an ASLowest
NEXT_HOPIdentifies the next-hop address used to reach the prefixMust be reachable
COMMUNITYTag attached to routes for policy decisionsDepends on policy

WEIGHT and LOCAL_PREF

WEIGHT affects only the Cisco router on which it is configured. LOCAL_PREF is normally the better choice when every BGP router in an AS should prefer the same outbound path.

For example, an enterprise with two Internet connections can assign LOCAL_PREF 200 to routes received from the primary provider and leave the secondary routes at the default value of 100.

AS_PATH

Each eBGP router adds its AS number to the AS_PATH before advertising a route. BGP uses the path to help prevent loops: if a router receives a route containing its own AS number, it normally rejects that route.

AS-path prepending deliberately repeats an AS number to make a path appear longer. It can influence how remote networks enter your AS, but it is only a signal; remote administrators may apply policies that override AS_PATH length.

NEXT_HOP

A valid BGP path is not usable unless its next hop can be resolved through the routing table. This is a frequent iBGP troubleshooting issue because an iBGP advertisement normally preserves the next hop learned from eBGP.

The next-hop-self command tells an iBGP router to advertise itself as the next hop. Internal routers must then have an IGP or static route to that router's peering address, commonly a loopback.

MED

The Multi-Exit Discriminator suggests which link a neighboring AS should use to enter your network. Lower values are preferred, and MEDs are normally compared only for paths received from the same neighboring AS unless the BGP configuration changes that behaviour.

How Does BGP Select the Best Path?

BGP evaluates attributes in a defined order until one path is preferred over the alternatives. On Cisco IOS and IOS XE, students should understand the main decision points while remembering that software features and explicit best-path commands can modify the process.

A practical simplified Cisco selection order is:

  1. Prefer the path with the highest WEIGHT.
  2. Prefer the path with the highest LOCAL_PREF.
  3. Prefer a path originated locally by the router.
  4. Prefer the shortest AS_PATH.
  5. Prefer the lowest ORIGIN type: IGP, then EGP, then incomplete.
  6. Prefer the lowest MED when the paths are eligible for MED comparison.
  7. Prefer an eBGP path over an iBGP path.
  8. Prefer the path with the lowest IGP metric to the BGP next hop.
  9. Apply later tie-breakers, such as path age, router ID and neighbor address.

The exact decision should be checked on the platform being used. Commands such as show ip bgp <prefix> reveal the available paths, selected best path and relevant attributes.

Worked path-selection example

Suppose R3 learns 203.0.113.0/24 through two edge routers:

PathLOCAL_PREFAS_PATHMED
Edge A20065100 65200100
Edge B100653000

Edge A wins even though it has a longer AS_PATH and higher MED. LOCAL_PREF is evaluated before AS_PATH and MED, so BGP stops at that decision point.

If both paths had LOCAL_PREF 100, Edge B would win because its AS_PATH is shorter. MED would not be reached as a deciding step.

How Do You Configure an eBGP and iBGP Lab?

The following lab creates an eBGP session between R1 and R2 and an iBGP session between R2 and R3. Loopbacks are used for iBGP because they remain available as long as the router has a working path to the loopback address.

Addressing plan

RouterInterface or networkAddressAS
R1Link to R210.0.12.1/3065001
R1Advertised LAN172.16.10.0/2465001
R2Link to R110.0.12.2/3065002
R2Link to R310.0.23.2/3065002
R2Loopback02.2.2.2/3265002
R3Link to R210.0.23.3/3065002
R3Loopback03.3.3.3/3265002
R3Advertised LAN192.168.30.0/2465002

R1 configuration

interface GigabitEthernet0/0
 ip address 10.0.12.1 255.255.255.252
 no shutdown
!
interface Loopback10
 ip address 172.16.10.1 255.255.255.0
!
router bgp 65001
 neighbor 10.0.12.2 remote-as 65002
 network 172.16.10.0 mask 255.255.255.0

The BGP network command does not create a route. An exact route for 172.16.10.0/24 must already exist in the routing table, which it does here because Loopback10 is directly connected.

R2 configuration

interface GigabitEthernet0/0
 ip address 10.0.12.2 255.255.255.252
 no shutdown
!
interface GigabitEthernet0/1
 ip address 10.0.23.2 255.255.255.252
 no shutdown
!
interface Loopback0
 ip address 2.2.2.2 255.255.255.255
!
ip route 3.3.3.3 255.255.255.255 10.0.23.3
!
router bgp 65002
 neighbor 10.0.12.1 remote-as 65001
 neighbor 3.3.3.3 remote-as 65002
 neighbor 3.3.3.3 update-source Loopback0
 neighbor 3.3.3.3 next-hop-self

R3 configuration

interface GigabitEthernet0/1
 ip address 10.0.23.3 255.255.255.252
 no shutdown
!
interface Loopback0
 ip address 3.3.3.3 255.255.255.255
!
interface Loopback30
 ip address 192.168.30.1 255.255.255.0
!
ip route 2.2.2.2 255.255.255.255 10.0.23.2
!
router bgp 65002
 neighbor 2.2.2.2 remote-as 65002
 neighbor 2.2.2.2 update-source Loopback0
 network 192.168.30.0 mask 255.255.255.0

In production, an IGP such as OSPF would normally provide loopback and next-hop reachability inside AS 65002. Static routes keep this small lab focused on BGP behaviour.

How Do You Verify the BGP Routes?

Start with the session summary, then inspect individual prefixes and confirm next-hop reachability. A session can be Established while a route is still missing because of an incorrect network statement, route policy or unreachable next hop.

R3# show ip bgp summary
BGP router identifier 3.3.3.3, local AS number 65002
Neighbor        V    AS MsgRcvd MsgSent Up/Down  State/PfxRcd
2.2.2.2        4 65002      28      30 00:18:42        1

A number in the final column means the session is Established and shows the number of received prefixes. Text such as Idle or Active indicates that the session is not established.

R3 should learn R1's LAN through iBGP:

R3# show ip bgp 172.16.10.0
BGP routing table entry for 172.16.10.0/24
  Paths: (1 available, best #1)
    65001
      2.2.2.2 from 2.2.2.2
        Origin IGP, localpref 100, valid, internal, best

The AS_PATH contains 65001, the route is marked internal because it came through iBGP, and the next hop is R2's loopback because R2 used next-hop-self.

Use these additional checks:

show ip bgp
show ip bgp neighbors
show ip route 2.2.2.2
show ip route bgp
show ip bgp 172.16.10.0
ping 2.2.2.2 source 3.3.3.3

How Do You Troubleshoot Common BGP Problems?

Troubleshoot BGP from the bottom up: verify interfaces and IP routing, test TCP reachability, check neighbor parameters, and then inspect route attributes and policies. Avoid changing attributes before confirming that the peer session and next hop are working.

1. The neighbor remains Active

Check basic reachability and the configured AS numbers:

show ip interface brief
show ip bgp summary
show running-config | section router bgp
ping 10.0.12.2
show access-lists

Confirm that an ACL or firewall is not blocking TCP port 179. For loopback-based peering, test with the correct source address and verify update-source Loopback0 on both routers.

2. The session is Established but no prefixes arrive

Verify that the advertised prefix exists exactly in the local routing table:

show ip route 172.16.10.0 255.255.255.0
show ip bgp neighbors 10.0.12.2 advertised-routes
show ip bgp neighbors 10.0.12.2 received-routes

Also inspect prefix lists, route maps and address-family activation. Some Cisco configurations use explicit address-family mode, where the neighbor must be activated under address-family ipv4 unicast.

3. The prefix appears in BGP but not in the routing table

Check whether the BGP next hop is reachable and whether another route source has a more preferred route:

show ip bgp 172.16.10.0
show ip route 2.2.2.2
show ip route 172.16.10.0
show ip bgp rib-failure

The show ip bgp rib-failure command is available on many Cisco IOS and IOS XE platforms and can explain why a BGP best path was not installed in the routing table.

4. An iBGP router does not pass a route to another iBGP router

This is expected behaviour under the iBGP advertisement rule. Build a full mesh for a small network or configure a route reflector for a scalable design; do not try to solve the issue by randomly redistributing BGP routes.

5. The wrong exit path is selected

Display every path and compare attributes in selection order:

show ip bgp 203.0.113.0
show ip bgp neighbors 203.0.113.1 routes
show route-map
show ip prefix-list

Use LOCAL_PREF to control the preferred exit for the complete AS. Use WEIGHT only when the decision should apply to one Cisco router, and document any MED or AS-path-prepending policy.

What Should You Remember About BGP Basics?

BGP forms TCP-based neighbor relationships and uses attributes to apply routing policy. eBGP exchanges routes between autonomous systems, while iBGP distributes those routes internally without advertising an iBGP-learned route to another iBGP peer by default.

Key points are:

  • Verify IP reachability before troubleshooting BGP policy.
  • Remember that the network command requires an exact route in the routing table.
  • Make the BGP next hop reachable through an IGP or static route.
  • Use next-hop-self where an edge next hop should be changed for internal peers.
  • Read path attributes in the same order used by the best-path process.
  • Use route reflectors when a full iBGP mesh is not practical.
  • Apply prefix filtering and routing policy deliberately rather than accepting or advertising every route by default.

To practise BGP, route policies, OSPF, troubleshooting and enterprise network design in guided labs, enquire about schedules and batch details for the CCNP Enterprise course.

Reviewed by Network Rhinos networking trainers.

Related reading: MPLS Explained: Labels, LSPs and Service Provider Use

Frequently asked questions

What is the main difference between eBGP and iBGP?

eBGP forms between routers in different autonomous systems, while iBGP forms between routers in the same autonomous system. eBGP adds the local AS to the AS_PATH, whereas iBGP does not.

Which BGP attribute is checked first on a Cisco router?

Cisco BGP first prefers the path with the highest WEIGHT. WEIGHT is Cisco-specific, remains local to one router and is not advertised to BGP neighbors.

Why is next-hop-self used in iBGP?

iBGP normally preserves the next-hop address of an advertised route. The `next-hop-self` command changes that address to the advertising router so internal peers can resolve the next hop through their IGP or static routes.

Does the BGP network command create a route?

No. The `network` command advertises a prefix only when an exact matching route already exists in the local routing table. The source route can be connected, static or learned through another routing protocol.

Why does an iBGP network need a full mesh?

A router does not advertise a route learned from one iBGP peer to another iBGP peer. A full mesh ensures that every BGP router receives the routes directly, while route reflectors provide a more scalable alternative.

What does the Active state mean in BGP?

Active means the router failed to establish the TCP connection and is trying again. Common causes include missing IP reachability, incorrect AS numbers, blocked TCP port 179 or an incorrect update source.

Related articles

Train with Network Rhinos

Hands-on CCNA, CCNP, AWS, Azure, DevOps and cybersecurity training in Chennai & Bangalore, with placement support. Talk to our team or attend a free demo class.