New Batch Starts on 16th Oct.
Module: Network Fundamentals (L2 L3 Protocol Testing)
Timing: 07:00 AM to 08:00 AM IST (Weekdays)
Sign Up Now !

BGP Configuration Example 2: EBGP Using Loopback Interfaces

BGP Configuration Example

In the last tutorial “BGP configuration example : EBGP Peering“, we configured an EBGP peering between two routers using their physical interface IP addresses. In this BGP configuration example, we’ll use loopback interfaces for BGP peering. We prefer loopback interfaces when there are multiple paths between peers because they provide more stability Using multiple paths ensures that even if one path disconnects, we can maintain the BGP peering through an alternate path.

Table of Contents


BGP Configuration Example 2: EBGP Using Loopback Interfaces

In this example, your objective is to configure EBGP between the routers using loopback interfaces and ensure that peering remains stable, even if one of the physical paths disconnects.

Topology:

A network topology with two routers for a BGP configuration example using loopback interfaces to form EBGP peering.

Note that each router has two loopback interfaces: one forms the peering, and the other is advertised using BGP to check if BGP is working.


In the last BGP configuration example, we used physical interfaces to form the peering, which was straightforward. However, when using loopback interfaces, we need to consider the following three things:

1. Route to Peer’s Loopback Interface:

First, our router won’t have a path or route to reach the peer’s loopback interface network address, so we need to add a route using another protocol like OSPF or a static route.

2. TTL Value Adjustment:

Second, EBGP peering uses a TTL value of 1 by default, but a TTL of 1 can’t reach the peer’s loopback interface because the router decrements it when forwarding a packet. Therefore, we need to configure a TTL of 2 or more using the “ebgp-multihop” command.

3. Source IP Address Update:

Finally, we need to change the source IP address of BGP packets.By default, the IP address of the interface used to send the packet to the neighbor is the source IP address of all BGP packets. However, in this case, the peer expects packets with the source IP set to the peer’s loopback interface.


Configuration Process:

Procedure Steps

  1. Connect the routers as given in the topology with two physical interfaces.
  2. Create two loopback interfaces on both routers.
    (Check the connectivity of both physical interfaces using ping.)
  3. Configure OSPF and advertise both the physical networks and one of the loopback networks.
  4. Wait for OSPF adjacency and ensure two paths are shown to the neighbor’s loopback network.
  5. On R1, configure BGP with AS 100.
    • Use the neighbor command with R2’s loopback interface IP and set the remote AS as 200.
    • Use the neighbor command with the update-source option and provide R1’s loopback interface number.
    • Use the neighbor command with the ebgp-multihop option to set the TTL to 2.
    • Use the network command to advertise the second loopback interface.
  6. (Perform a similar configuration on R2.)
  7. Check the BGP peering state using show ip bgp summary.
  8. Shut down one of the physical interfaces.
  9. Check whether BGP maintains the peering through the available path to the peer.

Router Configuration Commands :

R1 : Setting up physical and loopback interfaces.


R1 : OSPF Configuration Commands


R1 : BGP Configuration Commands


R2 : Setting up physical and loopback interfaces.


R2 : OSPF Configuration Commands


R2 : BGP Configuration Commands


By using two physical interfaces and configuring OSPF to advertise the loopback network through both, the routers will have two routes to reach the neighbor’s loopback. Use the command “show ip route 20.0.0.0” on R1 to see these two paths. This setup means BGP has two paths to reach its peer at 20.1.1.1. So, even if one physical path is disconnected, BGP can maintain the peering using the other path.

screenshot showing the output of "show ip route" with two paths to reach the same network
Output of “show ip route 20.0.0.0” on R1 showing two paths

With this, we have completed the first five steps. Now, let’s verify the configuration


Verification of Peering Stability

Step 6 : Check the peering status using “show ip bgp summary” on R1

Screenshot of the "show ip bgp summary" output showing successful peering with an EBGP peer

The above output shows that R1 has successfully established peering with 20.1.1.1 and has learned one network from that peer.


Step 7 and 8: Now that you have confirmed the peering has been formed, you can shut down one of the physical interfaces, “FE 0/0” or “FE 0/1”. Repeat the “show ip bgp summary” command, and you will see that BGP maintains the peering with R2.

screenshot showing the output "show ip bgp summary" after one physical link is disconnected.
Output showing BGP peer remains up even after one physical link is shut down

You can also check the peering using the debug command to show the keepalive packets. Use “debug ip bgp keepalives” and verify whether the routers are exchanging keepalives.

Screenshot showing BGP keepalive packets using the "debug ip bgp keepalives" command on a cisco router.
BGP Keepalive Packets Captured with “debug ip bgp keepalives” Command

Previous >>> BGP Configuration Example 1: EBGP Peering

Further reading : cisco


We’d love to hear your feedback and suggestions about this article. Feel free to reach out to us using the WhatsApp number below.

Sajith Achipra has been a trainer and testing consultant at Zframez Technologies since 2009. With 15+ years of experience, he specializes in networking, Python, development, and testing. He conducts online courses to help students and professionals enhance their skills. You can reach him on WhatsApp at +91 8884 884 844 for your training and testing requirements.