Configure And Verify
3.2.c Configure and verify eBGP between directly connected neighbors (best path selection algorithm and neighbor relationships)
Aligned to Cisco's 350-401 ENCOR v1.2 exam topics.
On this page
BGP is a path-vector routing protocol. For ENCOR, the focus is not internet-scale policy. It is basic eBGP between directly connected neighbors, neighbor state, and best path selection.
The clean mental model:
- Two routers form a TCP session on port 179.
- They exchange BGP routes called NLRI.
- Each route carries path attributes.
- BGP chooses the best path using those attributes.
- The best BGP route is installed only if the next hop is reachable and the route beats alternatives by administrative distance.
R1 AS 65001 ↔ R2 AS 65002 · TCP/179 -> OPEN -> KEEPALIVE -> UPDATE · NLRI -> show ip bgp summary · State EstablishedExternal BGP expects different autonomous systems on each side. iBGP between routers in the same AS uses different next-hop and loop-prevention rules.
Directly connected eBGP topology
R1 · AS 65001 · Lo0 192.0.2.1/32
10.12.0.0/30
R2 · AS 65002 · Lo0 192.0.2.2/32R1:
interface GigabitEthernet0/0
description To R2
ip address 10.12.0.1 255.255.255.252
no shutdown
!
interface Loopback0
ip address 192.0.2.1 255.255.255.255
!
router bgp 65001
bgp log-neighbor-changes
neighbor 10.12.0.2 remote-as 65002
network 192.0.2.1 mask 255.255.255.255R2:
interface GigabitEthernet0/0
description To R1
ip address 10.12.0.2 255.255.255.252
no shutdown
!
interface Loopback0
ip address 192.0.2.2 255.255.255.255
!
router bgp 65002
bgp log-neighbor-changes
neighbor 10.12.0.1 remote-as 65001
network 192.0.2.2 mask 255.255.255.255Verify:
show ip bgp summary
show ip bgp
show ip route bgp
show ip bgp neighbors 10.12.0.2The network command requirement
In BGP, network 192.0.2.1 mask 255.255.255.255 does not create the route. It tells BGP to advertise the route if the exact prefix already exists in the local routing table.
If the route is missing, BGP will not advertise it.
Check:
show ip route 192.0.2.1
show ip bgp 192.0.2.1A loopback interface or static route can satisfy the requirement.
Neighbor states
Common BGP states:
| State | Meaning |
|---|---|
| Idle | BGP is not connected. Check neighbor address, AS, reachability, ACLs. |
| Connect | Trying to establish TCP. Check IP path and port 179. |
| Active | Still trying. Despite the name, this often means not established. |
| OpenSent/OpenConfirm | BGP open messages are in progress. |
| Established | Neighbor is up and exchanging routes. |
If show ip bgp summary shows a number under State/PfxRcd, the session is established and the number is prefixes received. If it shows a word like Idle or Active, it is not established.
Direct eBGP troubleshooting
Check in this order:
ping 10.12.0.2
show ip interface brief
show run | section router bgp
show ip bgp summary
show tcp brief | include 179
show access-listsCommon problems:
- Wrong neighbor IP.
- Wrong remote AS.
- Interface down.
- No IP reachability.
- ACL blocking TCP 179.
- Using loopback peering without
update-sourceandebgp-multihop.
For directly connected physical-interface peering, you usually do not need ebgp-multihop.
Basic best path selection
BGP best path selection has many steps. For ENCOR, understand the common early tie-breakers:
- Highest weight. Cisco-local, not advertised.
- Highest local preference. Local AS-wide preference.
- Locally originated routes.
- Shortest AS path.
- Lowest origin code.
- Lowest MED.
- eBGP preferred over iBGP.
- Lowest IGP metric to next hop.
You do not need to memorize every later tie-breaker for basic ENCOR work, but you should recognize why a route with a shorter AS path can beat another route, and why changing local preference affects outbound path choice.
Best path lab
Add a second path from R1 to the same prefix through R3.
R2 · AS 65002 · advertises 203.0.113.0/24
R1 · AS 65001 · chooses best BGP path
R3 · AS 65003 · alternate eBGP pathOn R1, inspect routes:
show ip bgp 203.0.113.0Change local preference for routes learned from R3:
route-map PREFER-R3 permit 10
set local-preference 200
!
router bgp 65001
neighbor 10.13.0.3 route-map PREFER-R3 in
clear ip bgp 10.13.0.3 soft inVerify best path changed:
show ip bgp 203.0.113.0
show ip route 203.0.113.0Directly connected IPv6 eBGP example
R1:
ipv6 unicast-routing
!
interface Loopback0
ipv6 address 2001:db8:1::1/128
!
interface gi0/0
ipv6 address 2001:db8:12::1/64
!
router bgp 65001
neighbor 2001:db8:12::2 remote-as 65002
address-family ipv6
neighbor 2001:db8:12::2 activate
network 2001:db8:1::1/128
exit-address-familyThe IPv6 network statement has the same habit as IPv4: it advertises an exact prefix that already exists in the local IPv6 RIB. It does not create the route. This example advertises the connected Loopback0 /128; a /64 network statement would require an exact /64 route in the IPv6 RIB.
Verify:
show ipv6 route 2001:db8:1::1/128
show bgp ipv6 unicast summary
show bgp ipv6 unicast
show ipv6 route bgpExam traps
- Active is not “working.” Established is working.
- BGP uses TCP 179. IP reachability must exist first.
- The
networkcommand advertises an existing route; it does not create one. - eBGP direct neighbors usually use TTL 1. Loopback peering needs extra config.
- BGP best path and routing-table installation are separate. The BGP best path still needs a reachable next hop and must win against other route sources.
Quick checklist
- Can the peers ping each other?
- Are the local AS and remote AS correct?
- Is TCP 179 allowed?
- Is the BGP state Established?
- Does the advertised prefix exist in the local routing table?
- Is the BGP next hop reachable?
- Which BGP attribute explains the selected best path?