Internal BGP (iBGP)
Carry a route across an AS, then check the difference between a working BGP session and working end-to-end forwarding.
Transit AS
R1 originates 198.51.100.0/24 in AS 65010. R5, in AS 65030, reaches it through transit AS 65020. R2 and R4 are the transit borders; R3 initially runs only OSPF.
External sessions connect the ASes. A loopback-to-loopback iBGP session carries the route between R2 and R4. Internal routing supplies reachability to those endpoints; iBGP preserves the route attributes as it crosses the AS.
Redistributing external BGP routes through an IGP and back can lose BGP attributes and flood internal routing with unnecessary destinations. Here OSPF carries infrastructure reachability, while BGP carries the customer prefixes. Static reachability could also support the peer addresses; an IGP is not a protocol requirement.
Configuration
Use the interface addresses below. Keep the two customer-facing links out of OSPF so the next-hop dependency remains visible.
Interfaces and internal OSPF · fresh routers
R1
configure terminal
hostname R1
interface GigabitEthernet1
ip address 192.0.2.1 255.255.255.252
no shutdown
exit
interface Loopback0
ip address 10.255.0.1 255.255.255.255
exit
interface Loopback10
ip address 198.51.100.1 255.255.255.0
exit
endR2
configure terminal
hostname R2
interface GigabitEthernet1
ip address 192.0.2.2 255.255.255.252
no shutdown
exit
interface GigabitEthernet2
ip address 192.0.2.5 255.255.255.252
no shutdown
exit
interface Loopback0
ip address 10.255.0.2 255.255.255.255
exit
router ospf 1
router-id 10.255.0.2
passive-interface Loopback0
network 10.255.0.2 0.0.0.0 area 0
network 192.0.2.4 0.0.0.3 area 0
endR3
configure terminal
hostname R3
interface GigabitEthernet1
ip address 192.0.2.6 255.255.255.252
no shutdown
exit
interface GigabitEthernet2
ip address 192.0.2.9 255.255.255.252
no shutdown
exit
interface Loopback0
ip address 10.255.0.3 255.255.255.255
exit
router ospf 1
router-id 10.255.0.3
passive-interface Loopback0
network 10.255.0.3 0.0.0.0 area 0
network 192.0.2.4 0.0.0.3 area 0
network 192.0.2.8 0.0.0.3 area 0
endR4
configure terminal
hostname R4
interface GigabitEthernet1
ip address 192.0.2.10 255.255.255.252
no shutdown
exit
interface GigabitEthernet2
ip address 192.0.2.13 255.255.255.252
no shutdown
exit
interface Loopback0
ip address 10.255.0.4 255.255.255.255
exit
router ospf 1
router-id 10.255.0.4
passive-interface Loopback0
network 10.255.0.4 0.0.0.0 area 0
network 192.0.2.8 0.0.0.3 area 0
endR5
configure terminal
hostname R5
interface GigabitEthernet1
ip address 192.0.2.14 255.255.255.252
no shutdown
exit
interface Loopback0
ip address 10.255.0.5 255.255.255.255
exit
interface Loopback10
ip address 203.0.113.1 255.255.255.0
exit
endExternal sessions
First, connect R1 to R2 and R4 to R5. Only R1 originates a destination at this stage.
R1
configure terminal
router bgp 65010
bgp router-id 10.255.0.1
no bgp default ipv4-unicast
neighbor 192.0.2.2 remote-as 65020
address-family ipv4 unicast
neighbor 192.0.2.2 activate
network 198.51.100.0 mask 255.255.255.0
exit-address-family
endR2
configure terminal
router bgp 65020
bgp router-id 10.255.0.2
no bgp default ipv4-unicast
neighbor 192.0.2.1 remote-as 65010
address-family ipv4 unicast
neighbor 192.0.2.1 activate
exit-address-family
endR4
configure terminal
router bgp 65020
bgp router-id 10.255.0.4
no bgp default ipv4-unicast
neighbor 192.0.2.14 remote-as 65030
address-family ipv4 unicast
neighbor 192.0.2.14 activate
exit-address-family
endR5
configure terminal
router bgp 65030
bgp router-id 10.255.0.5
no bgp default ipv4-unicast
neighbor 192.0.2.13 remote-as 65020
address-family ipv4 unicast
neighbor 192.0.2.13 activate
exit-address-family
endInternal session
Inspect the available addresses. Loopback0 provides a stable session identity independent of one physical interface; its reachability still depends on the network.
R2# show ip interface brief
Interface IP-Address Status Protocol
GigabitEthernet1 192.0.2.2 up up
GigabitEthernet2 192.0.2.5 up up
Loopback0 10.255.0.2 up upR4# show ip interface brief
Interface IP-Address Status Protocol
GigabitEthernet1 192.0.2.10 up up
GigabitEthernet2 192.0.2.13 up up
Loopback0 10.255.0.4 up upCheck loopback reachability before adding the internal neighbor. The source address must match the remote neighbor statement.
R2# ping 10.255.0.4 source Loopback0
!!!!!
Success rate is 100 percent (5/5)R4# ping 10.255.0.2 source Loopback0
!!!!!
Success rate is 100 percent (5/5)R2
configure terminal
router bgp 65020
bgp router-id 10.255.0.2
no bgp default ipv4-unicast
neighbor 10.255.0.4 remote-as 65020
neighbor 10.255.0.4 update-source Loopback0
address-family ipv4 unicast
neighbor 10.255.0.4 activate
exit-address-family
endR4
configure terminal
router bgp 65020
bgp router-id 10.255.0.4
no bgp default ipv4-unicast
neighbor 10.255.0.2 remote-as 65020
neighbor 10.255.0.2 update-source Loopback0
address-family ipv4 unicast
neighbor 10.255.0.2 activate
exit-address-family
endThese commands add to the existing BGP process; they do not remove the external neighbors. R3 still runs no BGP. A loopback avoids tying the session endpoint to one physical interface, but reachability can still fail.
R2# show ip bgp summary
Neighbor V AS Up/Down State/PfxRcd
10.255.0.4 4 65020 00:03:10 0
192.0.2.1 4 65010 00:03:10 1Both neighbors are Established. R2 has received the customer prefix from R1; R4 has not originated a prefix toward R2 at this stage.
Next-hop verification
Follow the prefix from its origin. The following excerpts are illustrative, not recorded router results.
R1# show ip bgp 198.51.100.0/24
BGP routing table entry for 198.51.100.0/24
Paths: (1 available, best #1, table default)
Local
0.0.0.0
Origin IGP, localpref 100, valid, sourced, local, bestR2# show ip bgp 198.51.100.0/24
BGP routing table entry for 198.51.100.0/24
Paths: (1 available, best #1, table default)
65010
192.0.2.1
Origin IGP, localpref 100, valid, external, bestR4# show ip bgp 198.51.100.0/24
BGP routing table entry for 198.51.100.0/24
Paths: (1 available, no best path, table default)
65010
192.0.2.1 (inaccessible)
Origin IGP, localpref 100, internalR4# show ip route 192.0.2.1
% Network not in tableBefore the fix: R4 has the BGP path, but its next hop is inaccessible.
R5# show ip bgp 198.51.100.0/24
% Network not in tableR4 receives the path but cannot resolve its external next hop. No usable best path is exported to R5. Make the border router the internal next hop; configure both borders for traffic in either direction.
R2
configure terminal
router bgp 65020
address-family ipv4 unicast
neighbor 10.255.0.4 next-hop-self
exit-address-family
endR4
configure terminal
router bgp 65020
address-family ipv4 unicast
neighbor 10.255.0.2 next-hop-self
exit-address-family
endR4# show ip bgp 198.51.100.0/24
BGP routing table entry for 198.51.100.0/24
Paths: (1 available, best #1, table default)
65010
10.255.0.2
Origin IGP, localpref 100, valid, internal, bestR4# show ip route 198.51.100.0
Routing entry for 198.51.100.0/24
Known via "bgp 65020", distance 200, metric 0
* 10.255.0.2R5# show ip bgp 198.51.100.0/24
BGP routing table entry for 198.51.100.0/24
Paths: (1 available, best #1, table default)
65020 65010
192.0.2.13
Origin IGP, localpref 100, valid, external, bestR4 can now resolve the next hop through OSPF. R5 learns the prefix, but that alone does not prove the transit forwarding path works.
Transit forwarding
R5# traceroute 198.51.100.1 source 203.0.113.1
Tracing the route to 198.51.100.1
1 192.0.2.13
2 * * *The selected trace excerpt reaches R4, then gets no reply. A timeout alone does not prove which router dropped the packet; inspect the next forwarding hop’s destination route.
A packet from R5 must cross R3 on the way to R1. R3 has internal infrastructure routes but no route to the destination prefix. Check its IP table rather than only the border BGP tables.
R5# ping 198.51.100.1 source 203.0.113.1
.....
Success rate is 0 percent (0/5)R3# show ip route 198.51.100.0
% Network not in tableBefore adding R3 to iBGP, its forwarding table has no destination route.
Complete the internal mesh by adding R3. Its Loopback0 is already in OSPF. The original R2–R4 session stays in place.
R3
configure terminal
router bgp 65020
bgp router-id 10.255.0.3
no bgp default ipv4-unicast
neighbor 10.255.0.2 remote-as 65020
neighbor 10.255.0.2 update-source Loopback0
neighbor 10.255.0.4 remote-as 65020
neighbor 10.255.0.4 update-source Loopback0
address-family ipv4 unicast
neighbor 10.255.0.2 activate
neighbor 10.255.0.4 activate
exit-address-family
endR2
configure terminal
router bgp 65020
bgp router-id 10.255.0.2
no bgp default ipv4-unicast
neighbor 10.255.0.3 remote-as 65020
neighbor 10.255.0.3 update-source Loopback0
address-family ipv4 unicast
neighbor 10.255.0.3 activate
neighbor 10.255.0.3 next-hop-self
exit-address-family
endR4
configure terminal
router bgp 65020
bgp router-id 10.255.0.4
no bgp default ipv4-unicast
neighbor 10.255.0.3 remote-as 65020
neighbor 10.255.0.3 update-source Loopback0
address-family ipv4 unicast
neighbor 10.255.0.3 activate
neighbor 10.255.0.3 next-hop-self
exit-address-family
endR3# show ip bgp 198.51.100.0/24
BGP routing table entry for 198.51.100.0/24
Paths: (1 available, best #1, table default)
65010
10.255.0.2
Origin IGP, localpref 100, valid, internal, bestR3# show ip route 198.51.100.0
Routing entry for 198.51.100.0/24
Known via "bgp 65020", distance 200, metric 0
* 10.255.0.2R3 should now select the path through R2 and install the destination route. This ordinary IP transit lab needs destination routes at every forwarding hop; designs using tunnels or labels can have different requirements.
Return path
R5# ping 198.51.100.1 source 203.0.113.1
.....
Success rate is 0 percent (0/5)R1# show ip route 203.0.113.1
% Network not in tableThe destination route is now present in transit, but the reply still has no route back.
The ping can still fail: R1 has no return route to source 203.0.113.1. Originate R5’s connected /24 so the reply can cross the same transit AS.
R5
configure terminal
router bgp 65030
address-family ipv4 unicast
network 203.0.113.0 mask 255.255.255.0
exit-address-family
endR1# show ip route 203.0.113.0
Routing entry for 203.0.113.0/24
Known via "bgp 65010", distance 20, metric 0
* 192.0.2.2R5# ping 198.51.100.1 source 203.0.113.1
!!!!!
Success rate is 100 percent (5/5)With the completed configuration, both destination routes and their recursive next hops should be available. Check the actual ping result in your lab; the commands here are not a claim of an executed test.
iBGP adjacencies
An ordinary iBGP speaker does not pass an iBGP-learned route to another iBGP peer. Our internal pairs are R2–R3, R2–R4 and R3–R4: three logical sessions over two physical links.
Next-hop reachability, route distribution, transit forwarding and return routing are separate checks. A full mesh solves the distribution rule; it does not automatically solve the others. Route reflectors and confederations are covered later.
Remove one session
After both directions work, temporarily remove R2–R4 peering. The remaining R2–R3 and R3–R4 sessions still exist; R3 is an ordinary iBGP speaker, not a route reflector.
R2
configure terminal
router bgp 65020
no neighbor 10.255.0.4
endR4
configure terminal
router bgp 65020
no neighbor 10.255.0.2
endR3# show ip bgp
Network Next Hop Metric LocPrf Weight Path
*>i 198.51.100.0/24 10.255.0.2 0 100 0 65010 i
*>i 203.0.113.0/24 10.255.0.4 0 100 0 65030 iR2# show ip bgp 203.0.113.0/24
% Network not in tableR4# show ip bgp 198.51.100.0/24
% Network not in tableR3 retains both routes, but does not relay either iBGP-learned path to the other internal peer. The borders lose the remote customer paths after convergence even though the OSPF topology is unchanged.
Restore the full mesh
R2
configure terminal
router bgp 65020
neighbor 10.255.0.4 remote-as 65020
neighbor 10.255.0.4 update-source Loopback0
address-family ipv4 unicast
neighbor 10.255.0.4 activate
neighbor 10.255.0.4 next-hop-self
exit-address-family
endR4
configure terminal
router bgp 65020
neighbor 10.255.0.2 remote-as 65020
neighbor 10.255.0.2 update-source Loopback0
address-family ipv4 unicast
neighbor 10.255.0.2 activate
neighbor 10.255.0.2 next-hop-self
exit-address-family
endR4# show ip bgp 198.51.100.0/24
BGP routing table entry for 198.51.100.0/24
Paths: (1 available, best #1, table default)
65010
10.255.0.2 from 10.255.0.2
Origin IGP, localpref 100, valid, internal, bestRecreating the neighbor also requires its source, IPv4 activation and next-hop settings. The restored session lets the border advertise its externally learned route directly to the other border.
iBGP does not prepend the local AS on these internal advertisements. The default advertisement restriction prevents circulation between ordinary internal peers; route reflectors add separate rules, covered later.
Final configurations
Completed five-router lab · full mesh restored
R1
configure terminal
hostname R1
interface GigabitEthernet1
ip address 192.0.2.1 255.255.255.252
no shutdown
exit
interface Loopback0
ip address 10.255.0.1 255.255.255.255
exit
interface Loopback10
ip address 198.51.100.1 255.255.255.0
exit
router bgp 65010
bgp router-id 10.255.0.1
no bgp default ipv4-unicast
neighbor 192.0.2.2 remote-as 65020
address-family ipv4 unicast
neighbor 192.0.2.2 activate
network 198.51.100.0 mask 255.255.255.0
exit-address-family
endR2
configure terminal
hostname R2
interface GigabitEthernet1
ip address 192.0.2.2 255.255.255.252
no shutdown
exit
interface GigabitEthernet2
ip address 192.0.2.5 255.255.255.252
no shutdown
exit
interface Loopback0
ip address 10.255.0.2 255.255.255.255
exit
router ospf 1
router-id 10.255.0.2
passive-interface Loopback0
network 10.255.0.2 0.0.0.0 area 0
network 192.0.2.4 0.0.0.3 area 0
exit
router bgp 65020
bgp router-id 10.255.0.2
no bgp default ipv4-unicast
neighbor 192.0.2.1 remote-as 65010
neighbor 10.255.0.3 remote-as 65020
neighbor 10.255.0.3 update-source Loopback0
neighbor 10.255.0.4 remote-as 65020
neighbor 10.255.0.4 update-source Loopback0
address-family ipv4 unicast
neighbor 192.0.2.1 activate
neighbor 10.255.0.3 activate
neighbor 10.255.0.3 next-hop-self
neighbor 10.255.0.4 activate
neighbor 10.255.0.4 next-hop-self
exit-address-family
endR3
configure terminal
hostname R3
interface GigabitEthernet1
ip address 192.0.2.6 255.255.255.252
no shutdown
exit
interface GigabitEthernet2
ip address 192.0.2.9 255.255.255.252
no shutdown
exit
interface Loopback0
ip address 10.255.0.3 255.255.255.255
exit
router ospf 1
router-id 10.255.0.3
passive-interface Loopback0
network 10.255.0.3 0.0.0.0 area 0
network 192.0.2.4 0.0.0.3 area 0
network 192.0.2.8 0.0.0.3 area 0
exit
router bgp 65020
bgp router-id 10.255.0.3
no bgp default ipv4-unicast
neighbor 10.255.0.2 remote-as 65020
neighbor 10.255.0.2 update-source Loopback0
neighbor 10.255.0.4 remote-as 65020
neighbor 10.255.0.4 update-source Loopback0
address-family ipv4 unicast
neighbor 10.255.0.2 activate
neighbor 10.255.0.4 activate
exit-address-family
endR4
configure terminal
hostname R4
interface GigabitEthernet1
ip address 192.0.2.10 255.255.255.252
no shutdown
exit
interface GigabitEthernet2
ip address 192.0.2.13 255.255.255.252
no shutdown
exit
interface Loopback0
ip address 10.255.0.4 255.255.255.255
exit
router ospf 1
router-id 10.255.0.4
passive-interface Loopback0
network 10.255.0.4 0.0.0.0 area 0
network 192.0.2.8 0.0.0.3 area 0
exit
router bgp 65020
bgp router-id 10.255.0.4
no bgp default ipv4-unicast
neighbor 192.0.2.14 remote-as 65030
neighbor 10.255.0.2 remote-as 65020
neighbor 10.255.0.2 update-source Loopback0
neighbor 10.255.0.3 remote-as 65020
neighbor 10.255.0.3 update-source Loopback0
address-family ipv4 unicast
neighbor 192.0.2.14 activate
neighbor 10.255.0.2 activate
neighbor 10.255.0.2 next-hop-self
neighbor 10.255.0.3 activate
neighbor 10.255.0.3 next-hop-self
exit-address-family
endR5
configure terminal
hostname R5
interface GigabitEthernet1
ip address 192.0.2.14 255.255.255.252
no shutdown
exit
interface Loopback0
ip address 10.255.0.5 255.255.255.255
exit
interface Loopback10
ip address 203.0.113.1 255.255.255.0
exit
router bgp 65030
bgp router-id 10.255.0.5
no bgp default ipv4-unicast
neighbor 192.0.2.13 remote-as 65020
address-family ipv4 unicast
neighbor 192.0.2.13 activate
network 203.0.113.0 mask 255.255.255.0
exit-address-family
endKey Takeaways
- iBGP carries BGP routes between routers in the same AS without prepending that AS on ordinary internal advertisements.
- Peer addresses must be reachable first; loopback peering uses update-source and suitable underlying routing.
- A received route needs a reachable next hop before it can be used; next-hop-self fixes that dependency at our borders.
- Every ordinary IP forwarding hop needs a destination route, and the destination needs a route back to the test source.
- Ordinary iBGP does not relay an iBGP-learned route to another iBGP peer; this lab therefore uses a full logical mesh.