PacketLab
Unit 1 · BGP

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.

Five-router transit networkIllustrative topology
AS 65010Transit AS 65020AS 65030Initial iBGP: R2 ↔ R4192.0.2.0/30192.0.2.4/30192.0.2.8/30192.0.2.12/30R1Lo0: 10.255.0.1R2Lo0: 10.255.0.2R3Lo0: 10.255.0.3R4Lo0: 10.255.0.4R5Lo0: 10.255.0.5OSPF: R2–R3–R4 · R3 initially has no BGP
Solid lines: physical links. Dashed line: the initial logical R2–R4 iBGP session. R3 joins the internal BGP mesh later in the lesson. Link addresses and interfaces are listed in the configuration.

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
end

R2

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

end

R3

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

end

R4

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

end

R5

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
end

External 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
end

R2

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
end

R4

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
end

R5

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
end

Internal session

Inspect the available addresses. Loopback0 provides a stable session identity independent of one physical interface; its reachability still depends on the network.

Illustrative router output · selected lines
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      up
Illustrative router output · selected lines
R4# 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      up

Check loopback reachability before adding the internal neighbor. The source address must match the remote neighbor statement.

Illustrative router output · selected lines
R2# ping 10.255.0.4 source Loopback0
!!!!!
Success rate is 100 percent (5/5)
Illustrative router output · selected lines
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
end

R4

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
end

These 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.

Illustrative router output · selected lines
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             1

Both 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.

Illustrative router output · selected lines
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, best
Illustrative router output · selected lines
R2# 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, best
Illustrative router output · selected lines
R4# 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, internal
Illustrative router output · selected lines
R4# show ip route 192.0.2.1
% Network not in table

Before the fix: R4 has the BGP path, but its next hop is inaccessible.

Illustrative router output · selected lines
R5# show ip bgp 198.51.100.0/24
% Network not in table

R4 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
end

R4

configure terminal
router bgp 65020
 address-family ipv4 unicast
  neighbor 10.255.0.2 next-hop-self
 exit-address-family
end
Illustrative router output · selected lines
R4# 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, best
Illustrative router output · selected lines
R4# 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.2
Illustrative router output · selected lines
R5# 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, best

R4 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

Illustrative router output · selected lines
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.

Illustrative router output · selected lines
R5# ping 198.51.100.1 source 203.0.113.1
.....
Success rate is 0 percent (0/5)
Illustrative router output · selected lines
R3# show ip route 198.51.100.0
% Network not in table

Before 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
end

R2

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
end

R4

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
end
Illustrative router output · selected lines
R3# 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, best
Illustrative router output · selected lines
R3# 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.2

R3 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

Illustrative router output · selected lines
R5# ping 198.51.100.1 source 203.0.113.1
.....
Success rate is 0 percent (0/5)
Illustrative router output · selected lines
R1# show ip route 203.0.113.1
% Network not in table

The 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
end
Illustrative router output · selected lines
R1# 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.2
Illustrative router output · selected lines
R5# 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

Completed internal full meshIllustrative topology
AS 65020 · logical iBGP sessionsR2 ↔ R4R2Lo0: 10.255.0.2R3Lo0: 10.255.0.3R4Lo0: 10.255.0.4
Lines represent logical BGP sessions, not physical cables. All three internal pairs are neighbors.

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.

Experiment: remove R2–R4 peeringIllustrative topology
AS 65020 · logical iBGP sessionsR2–R4 session removedR2Lo0: 10.255.0.2R3Lo0: 10.255.0.3R4Lo0: 10.255.0.4
Lines represent remaining logical BGP sessions. R3 is an ordinary speaker and does not relay iBGP-learned routes between the borders.

R2

configure terminal
router bgp 65020
 no neighbor 10.255.0.4
end

R4

configure terminal
router bgp 65020
 no neighbor 10.255.0.2
end
Illustrative router output · selected lines
R3# 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 i
Illustrative router output · selected lines
R2# show ip bgp 203.0.113.0/24
% Network not in table
Illustrative router output · selected lines
R4# show ip bgp 198.51.100.0/24
% Network not in table

R3 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
end

R4

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
end
Illustrative router output · selected lines
R4# 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, best

Recreating 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
end

R2

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
end

R3

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
end

R4

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
end

R5

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
end

Key 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.

Internal BGP Quiz

Six questions · four options each · select one answer per question. Submit all answers to see your score and explanations.

1. R2 and R4 are in the same AS but separated by R3. Can they form iBGP?
2. R4 receives a path whose next hop is 192.0.2.1, but it has no route to that address. What is missing?
3. What does next-hop-self on R2 accomplish in this lab?
4. R5 has a route to R1’s prefix, but R3 has no destination route. What happens to ordinary IP traffic?
5. R2–R4 peering is removed, leaving R2–R3 and R3–R4. Why does R4 lose the path learned by R3 from R2?
6. The forward routes are present, but R1 has no route to ping source 203.0.113.1. What must be fixed?
Technical references

BGP specification · BGP configuration · Symbol credits.