Why does the route stop at R2?
On the course network, R1 learns 203.0.113.0/24 from ISP A over eBGP and passes it to R2 over iBGP. R2 stores the announcement, but cannot use this path because it cannot reach the announced next hop. A user on the company LAN is trying to reach a service at 203.0.113.10. R2 must use another eligible route, if one exists, or discard the packet. Seeing the prefix in the BGP table is not enough.
On small screens, swipe sideways or focus the diagram and use the arrow keys.
External BGP (eBGP) is a session between routers in different autonomous systems. An autonomous system (AS) is a routing domain identified by an AS number. Internal BGP (iBGP) is a session between routers in the same AS. These names describe the AS relationship, not whether the cable is inside or outside a building.
R1 and R2 are in company AS 64500. ISP A is AS 64501. R1 learns the external prefix from ISP A and uses iBGP to tell R2 about it. A next hop is the IP address towards which a router must resolve a route before forwarding packets.
Know the addresses before following the route
On small screens, swipe sideways or focus the diagram and use the arrow keys.
A loopback is a software interface. OSPF, our internal routing protocol, already carries the loopback /32 routes across the internal link. The iBGP session uses these stable endpoints. The router IDs are identifiers, not the addresses of that session. The company LAN is 198.51.100.0/24; the server-shaped symbol in the diagram represents that whole LAN.
What differs between eBGP and iBGP
On small screens, swipe sideways or focus the diagram and use the arrow keys.
Administrative distance is Cisco's local preference between routing sources for the same prefix. With these defaults, eBGP distance 20 is preferred to OSPF distance 110; iBGP distance 200 is less preferred than OSPF. This comparison applies to the same prefix and mask. It does not make an eBGP /16 override a more-specific OSPF /24 when forwarding to that /24.
On small screens, swipe sideways or focus the diagram and use the arrow keys.
TTL (time to live) limits how many routers an IP packet can cross. It applies to the packets carrying the BGP session, not to every user packet using a BGP route. An IGP (interior gateway protocol), such as OSPF, provides internal reachability; static routes can also provide it.
The next hop does not change inside the AS
On small screens, swipe sideways or focus the diagram and use the arrow keys.
ISP A advertises 203.0.113.0/24 with next hop 192.0.2.1. R1 can reach that address on its directly connected provider link. R2 knows R1's loopback but, at this stage, has no route to 192.0.2.1. Ordinary iBGP preserves the external next hop, so the announcement alone does not tell R2 how to reach it.
An established iBGP session does not guarantee that the next hop of every learned route is reachable.
Device key: ISP A, ISP B, R1, R2 (router) · Company LAN, AS 64500 (network / site)
Lines show the example’s network connections. Thick links: uplinks/WAN, as labelled. The coloured path and envelope follow the current step; its text identifies the sender, receiver and traffic type.
Reading the addresses
IP labels identify interfaces or destinations. Subnet labels identify networks; /n is the prefix length. A router ID (RID) identifies a routing process and need not be a reachable interface.
An IP address alone is not a URL. A web URL includes a scheme such as https://; an address on a router or printer does not imply a website.
- ISP A: AS 64501
- ISP B: AS 64502
- R1: RID 1.1.1.1
- R2: RID 2.2.2.2
- Company LAN, AS 64500: Subnet 198.51.100.0/24
- 1. eBGP from ISP A: ISP A sets the next hop to its own address, 192.0.2.1, and the AS path to 64501.
- 2. iBGP to R2, unchanged: R1 passes the route on with the same next hop and AS path.
- 3. R2 can't use it: R2 has no route to 192.0.2.1, the subnet on R1's ISP link, so the BGP route is not valid for R2.
- 4. With next-hop-self on R1: R1 puts its own loopback in the next hop, which R2 reaches through OSPF, and the route is usable.
R2#show ip bgp Network Next Hop Metric LocPrf Weight Path i 203.0.113.0 192.0.2.1 0 100 0 64501 i *> 198.51.100.0 0.0.0.0 0 32768 i
i in the left status columns marks an iBGP-learned route. The missing *means this path is not valid for selection: next hop 192.0.2.1 is unreachable. The missing >means it is not BGP's best path. The final i, after 64501, is a different field: the origin code. Here it says the prefix was originated using BGP's IGP-origin mechanism, commonly a network statement. The prefix is /24; this illustrative IOS output omits its classful mask.There are two common fixes. The usual one is to make R1 advertise itself as the next hop to its iBGP neighbours:
router bgp 64500
neighbor 10.255.0.2 next-hop-selfR1. Routes sent to R2 now carry R1's update-source address (its loopback, 10.255.0.1) as the next hop. R2 reaches that through OSPF.
R2#show ip bgp Network Next Hop Metric LocPrf Weight Path *>i 203.0.113.0 10.255.0.1 0 100 0 64501 i *> 198.51.100.0 0.0.0.0 0 32768 i
* marks a valid path and > marks BGP's best path. With no better competing routing source in this example, it is installed with distance 200. Confirm with show ip route 203.0.113.10; the BGP best marker alone does not prove installation. Another fix is to provide internal routes to the provider link, but that spreads provider addressing through the company network.Why iBGP needs a full mesh
On small screens, swipe sideways or focus the diagram and use the arrow keys.
eBGP loop prevention relies on the AS path, but iBGP doesn't change the AS path, so it can't catch a loop inside one AS. BGP prevents that with a simple rule: a route learned from an iBGP neighbour is not advertised to another iBGP neighbour. The consequence is that every BGP router in this ordinary iBGP design must have a session with every other BGP router that needs these routes. This requirement is a full mesh of BGP sessions, not a full mesh of physical cables.
Device key: RA, RB, RC, RD (router)
Lines show the example’s network connections. The coloured path and envelope follow the current step; its text identifies the sender, receiver and traffic type.
- 1. RA tells RB: RA learned a route over eBGP and sends it to its iBGP neighbour RB.
- 2. RB stops there: RB learned it over iBGP, so it doesn't pass it on to RD; RD needs its own session with RA.
- 3. The fix is a session to everyone: Four routers need 6 iBGP sessions: n × (n − 1) / 2.
Sessions don't follow cables: an iBGP session runs over TCP between loopbacks, wherever the IGP can reach. Even so, 10 routers need 45 sessions and 50 need 1 225. Large networks replace the full mesh with route reflectors, which are allowed to pass iBGP routes on; Module 5 configures one.
Mistakes that come from mixing the two
On small screens, swipe sideways or focus the diagram and use the arrow keys.
- Expecting iBGP to change the next hop. It doesn't, so remote iBGP routers need
next-hop-selfor a route to the ISP link. - Peering eBGP between loopbacks with only the default connected-neighbour settings. Check routing, update-source and the connected-neighbour or multihop settings together.
- Leaving out iBGP sessions between some routers and expecting routes to pass through them.
- Being surprised that an iBGP route (200) loses to the same prefix in OSPF (110). That is by design.
Check the repair yourself
Use a Cisco IOS or IOS XE lab with the interfaces and loopbacks above, working OSPF loopback reachability, an established R1–ISP A session and an established R1–R2 iBGP session sourced from Loopback0. ISP A must already advertise the example prefix. These commands add a next-hop repair; they do not build those prerequisites.
show ip bgp 203.0.113.0 255.255.255.0
show ip route 192.0.2.1
show ip route 10.255.0.1R2, privileged EXEC mode. Before the repair, compare the unreachable provider next hop with the reachable R1 loopback.
On R1, enter global configuration mode, open router bgp 64500 and apply the earlier neighbor 10.255.0.2 next-hop-self command. IOS variants using explicit address families place this command under address-family ipv4 unicast. Recheck R2 after the new advertisement arrives; avoid a disruptive hard session reset simply to test a route-policy change.
show ip bgp 203.0.113.0 255.255.255.0
show ip route 203.0.113.10R2, after the change. Expect next hop 10.255.0.1 and a usable route. If it still fails, check the loopback route and the peer's update-source configuration before changing other settings.
The trade-off is management: a full mesh is straightforward for a few routers, but its session count grows quickly. Route reflectors reduce the count and add their own design rules. Technical references: RFC 4271 and Cisco's BGP troubleshooting guide. Examples are illustrative, not a claim of a physical-router test.
Test yourself on eBGP and iBGP
R2 learns 203.0.113.0/24 from R1 over iBGP. R1 learned it from ISP A (192.0.2.1). R1 has no next-hop-self. What next hop does R2 see?
What is the administrative distance of an iBGP route on Cisco IOS?
Five BGP routers in one AS, no route reflector. How many iBGP sessions are needed?
R1 and ISP A configure eBGP between their loopback addresses, with no other settings. The session never comes up. Why?