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 1: EBGP Peering

BGP Configuration Example:

In the previous chapter, you learned about BGP’s peering process and states. In this BGP configuration example , you will learn how to configure BGP with two Cisco routers, check the BGP peering status, and understand different BGP show commands. We’ll provide step-by-step instructions to set up an EBGP peering, verify the peering connection, and use show commands to monitor and troubleshoot the BGP session. By the end of this tutorial, you’ll have the foundational knowledge needed to start configuring BGP Protocol in real-world scenarios using Cisco devices, serving as a strong base for building more complex BGP topologies in your network.

Table of Contents


BGP Configuration Example 1: Configuring EBGP Peering on Cisco routers.

In this example, your objective is to establish an EBGP peering between two routers, R1 and R2, located in different autonomous systems as shown in the topology given below. You’ll configure the EBGP peering using the IP addresses of the physical interfaces connecting these routers and advertise the loopback networks from both routers.

Topology:

A network topology showing two routers used in bgp configuration example for ebgp.
EBGP configuration topology

As you can see in the topology, router R1 is in AS 1000, and R2 is in AS 2000. R1 has a loopback interface with the network 10.0.0.0/8, and R2 with 20.0.0.0/8. We need these loopback networks to ensure BGP can advertise and learn networks. For example, by checking whether R2 has learned the network 10.0.0.0/8 via BGP, we can understand that R1 successfully advertised the network, and R2 was able to learn it.

You can configure a basic BGP peering using 3 steps on a Cisco router:

  • Step 1: Use the “router bgp AS-number” to enter BGP protocol configuration mode.
  • Step 2: Use the “neighbor Peer’s-IP-Address remote-as Peer’s-AS-number” to start the BGP peering process
  • Step 3: Use the “network network-address mask mask-of-the-network” to advertise a network to the peer.

Procedure Steps

  1. Configure IP addresses on the physical interfaces connecting R1 and R2.
  2. On both routers, add loopback interfaces and configure the IP addresses as specified in the topology. Verify connectivity by pinging from R1 to R2 to ensure connectivity.
  3. On both R1 and R2, configure BGP, add the neighbor, and advertise the loopback networks.
  4. Verify peering by checking the BGP peering status and verifying the entries in the BGP table.

Router Configuration Commands:

R1 Configuration: Setting Up IP Addresses and Loopback Interface


R1 Configuration: Configuring BGP AS, Neighbor, and Network Advertisement


R2 Configuration: Setting Up IP Addresses and Loopback Interface


R2 Configuration: Configuring BGP AS, Neighbor, and Network Advertisement


Note that we use AS 1000 on R1 and AS 2000 on R2, making them EBGP peers. BGP starts the peering process when we issue the “neighbor” command. However, we need to ensure the neighbor’s IP address matches the interface IP address on the neighbor, and the AS number of the neighbor is correctly configured

To advertise the network address of the loopback interface, we use the “network” command. In BGP, we must manually specify the neighbor’s IP address and advertise the networks separately. This differs from OSPF, EIGRP, or RIP, where only the “network” command is needed.


Verifying the BGP Peering:

You can use the following “show” commands on a Cisco router to check the BGP peering status, networks in bgp table, and details of the networks learned:


Checking the peering withshow ip bgp summary” :

The “show ip bgp summary” command gives you a quick overview of the BGP status on your router. It shows the number of BGP neighbors, their IP addresses, and the current state of each peering session. You’ll see the AS number of each peer, the number of routes received, and the duration of the established peering. This command helps you quickly assess the health and status of your BGP connections.

A screenshot showing the output of the "show ip bgp summary" command on a Cisco router's CLI
Output of “show ip bgp summary” on R1

Checking the BGP database with “show ip bgp” :

The “show ip bgp” command provides detailed information about the BGP routing table on your router. It displays the routes learned through BGP, including the network prefixes, next-hop addresses, path attributes, and status codes. This command helps you see which routes BGP advertises, the path it takes to reach them, and any applied policies. It’s a valuable tool for troubleshooting and verifying the routing information in your BGP configuration

A screenshot showing the output of the "show ip bgp" command on a Cisco router's CLI
Output of “show ip bgp” on R1

Understandingshow ip bgp” Output:

In the output above, you can see two networks (10.0.0.0 and 20.0.0.0) in the BGP table.

Status Code: *>
The status code will show * if a route is valid and the next hop is reachable. The > indicates that this path is the best path to the reachable destination. If the route is learned from an iBGP peer, the status code will be *>i.

Next Hop:
If the Next Hop column shows 0.0.0.0, it indicates that this network is directly connected. In the output above, R1 sets the next hop as 0.0.0.0 for the connected network 10.0.0.0.

Metric:
This column displays the value of the MED (Multi-Exit Discriminator) attribute. By default, MED is set to 0.

LocPrf:
The Local Preference attribute is not applicable for eBGP peering, so this column is not populated in this scenario. For routes learned from iBGP peers, the local preference is set to 100 by default.

Weight:
By default, the weight is set to 32768 for all local networks and 0 for iBGP and eBGP routes.

Path and Origin Code:
This column shows the value of the AS-PATH attribute. The symbol at the end of the line indicates the origin code. In the output above, the origin code is i, meaning that the network is originally advertised by a BGP-speaking router connected to that network.


Checking the path attributes with “show ip bgp <network address>” :

The “show ip bgp ” command gives you detailed information about a specific BGP route. By specifying the network address, you can see all the path attributes associated with that route, including the next-hop IP address, AS path, origin, and any BGP policies applied. This command helps you analyze how BGP handles a particular route, making it easier to troubleshoot routing issues or verify the route’s configuration.

A screenshot showing the output of "show ip bgp 20.0.0.0" command on  R1, a cisco router used in this bgp configuration example
Output of “show ip bgp 20.0.0.0” on R1

In this BGP configuration example, we discussed BGP peering using the IP addresses of the peers’ physical interfaces. Next, we will learn how to use loopback interfaces to form the peering.


Next >>> BGP Configuration Example 2: EBGP Using Loopback Interfaces

Previous >>> BGP Protocol Peering and States

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.