iBGP Over Loopbacks
Bring up an iBGP session between two routers in one AS, peering on loopbacks over an OSPF underlay.
Download the lab (topology + configs), unzip it, then from that folder run containerlab deploy -t topology.clab.yml.
iBGP Over Loopbacks
Two routers. One company. One autonomous system. They already speak OSPF to each other, so each can reach the other's loopback. Now you'll layer iBGP on top, peering not on the wire between them but on their stable loopback addresses.
By the end of this lab you'll have a working iBGP session between r1 and r2, both in AS 65001, sourced from their loopbacks and riding on the OSPF underlay that is already up.
Topology
The interface addressing and the OSPF underlay are already configured for you. OSPF advertises both the link and the loopbacks, so r1 already has a route to 2.2.2.2 and r2 already has a route to 1.1.1.1. The iBGP overlay is the part you'll build.
Deploy the lab
Download the lab and unzip it (the download includes the topology and the router configs). From inside the unzipped folder, run:
containerlab deploy -t topology.clab.ymlThat boots both routers. Drop into r1's FRR shell:
docker exec -it clab-bgp-ibgp-peering-r1 vtyshStep 1: Confirm the underlay first
iBGP on loopbacks only works if the loopbacks are reachable. OSPF is meant to handle that, so prove it before touching BGP. On r1:
You should see a route to 2.2.2.2/32 learned via OSPF (marked with an O), with a next hop of 10.0.12.2 out eth1. That OSPF route is exactly what makes the loopback peering possible. While you're here, confirm BGP isn't running yet:
Step 2: Configure iBGP on r1
Enter configuration mode and start a BGP process in AS 65001, then point it at r2's loopback (2.2.2.2). Because the neighbor is in the same AS, this is an iBGP session. Source it from lo so the TCP session originates from your loopback, and advertise your own loopback into BGP:
Because the neighbor's AS (65001) is the same as our own (65001), this is an iBGP session. The update-source lo line tells BGP to source the session from the loopback, which is the address r2 expects to peer with.
Notice there's no
no bgp ebgp-requires-policyhere. RFC 8212 enforcement is eBGP-only, so iBGP routes flow without it. That rule applies to external sessions, not sessions inside your own AS.
Step 3: Configure iBGP on r2
A BGP session takes two. Open r2 in another terminal:
docker exec -it clab-bgp-ibgp-peering-r2 vtyshMirror the configuration: r2 is also in AS 65001, its neighbor r1 is reached on loopback 1.1.1.1, and it advertises its own loopback:
Step 4: Verify
Back on r1, watch the session come up:
Within a few seconds the neighbor 2.2.2.2 (the loopback, not the wire address) should move to Established. Now check that the loopbacks actually crossed the session. On r2:
You should see 1.1.1.1/32 in r2's BGP table, learned from r1. Its AS_PATH will look empty, that's normal: iBGP does not prepend the local AS, so a prefix that never left AS 65001 carries no ASNs in its path.
✅ Objective 1: the iBGP session from r1 to r2's loopback (2.2.2.2) is Established.
✅ Objective 2: r2 has learned r1's loopback 1.1.1.1/32 over iBGP.
Troubleshooting
- Stuck in
ActiveorConnect? You probably forgotupdate-source lo, so the session is sourced from the wrong address andr2rejects it. Or the loopback simply isn't reachable: runshow ip route 2.2.2.2and confirm OSPF has a route. - Session won't form at all? For iBGP the
remote-asmust equal your own AS (65001 on both sides). If you typed a different AS, BGP would treat it as eBGP and the loopback peering would not behave as expected. - Session up but no
1.1.1.1/32on r2? Make surer1actually advertises it withnetwork 1.1.1.1/32. An Established session exchanges nothing on its own.
Tear down
containerlab destroy -t topology.clab.ymlWhat you learned
- An iBGP session is one between neighbors in the same autonomous system, so
remote-asequals your own AS. - Peering on loopbacks needs an IGP underlay (here OSPF) to make the loopbacks reachable, plus
neighbor <ip> update-source loso the session sources from the loopback. - iBGP does not require
no bgp ebgp-requires-policy; RFC 8212 enforcement is eBGP-only. - A prefix that stays inside one AS carries an empty AS_PATH, because iBGP does not prepend the local AS.
Next: fix the iBGP next-hop problem so these routes are actually usable, in bgp-next-hop-self.
Objectives
0/2 verifiedRun each command against your running lab, confirm what you see, and tick it off. Self-assessed for now; a hosted auto-grader will check these for you later.
The iBGP session from r1 to r2's loopback (2.2.2.2) is Established.
$ docker exec -it clab-bgp-ibgp-peering-r1 vtysh -c 'show ip bgp summary'r2 has learned r1's loopback 1.1.1.1/32 over iBGP.
$ docker exec -it clab-bgp-ibgp-peering-r2 vtysh -c 'show ip bgp 1.1.1.1/32'