Configure eBGP in Cisco IOS Router

BGP stands for Border Gateway Protocol and is a routing protocol that builds this gigantic inter-network connection that is known to us all as the internet. There are two types of BGP, namely internal BGP (iBGP) and external BGP (eBGP). The protocols and attributes used in either iBGP or eBGP are standardized for all vendors, including Cisco. In this article, we will give an example of how to configure eBGP in Cisco IOS router and establish eBGP connection between different network entities.

How to Configure eBGP in Cisco IOS Router

External BGP or eBGP is essentially a routing protocol that connects one independent network entity to a different network entity. This independent network entity is called Autonomous System (AS), and each one of them has an AS number as assigned by IANA (Internet Assigned Number Authority). The AS number is ranging from 1-64511 for public use and 64512-65535 for private use. Just like public IP address space, the public AS number is unique, means that an AS number can only be associated to one entity.

Figure below is the example of eBGP connection between two AS:

In this scenario, R1 and R2 are Cisco IOS router and each of them is part of an AS. R1 is part of AS 65531 with two network subnets directly connected to it, while R2 is part of AS 65532 with one network subnet directly connected to it. The goal here is to establish inter-AS connection that enables these subnets talk to each other through eBGP.

The steps to configure eBGP in Cisco IOS Router and achieve the above goal is as follows:

1. Defining the AS number

The configuration starts by activating the BGP routing protocol on the router global configuration and specifying its AS number. The command to do so is: router bgp [AS_number].

On the above example, the command on R1 will looks like this:

R1(config)#router bgp 65531
R1(config-router)#

Meanwhile, the command on R2 will looks like this:

R2(config)#router bgp 65532
R2(config-router)#

Notice that after running the commands above, we are entering the routing configuration mode.

2. Defining the neighboring BGP router

On each router, enter the command neighbor [neighbor_router_address] remote-as [neighbor_AS_number] in the routing configuration mode. Once configured, give the router time approximately 10-20 seconds to form the BGP peering because BGP convergence time is relatively slower than any IGP routing. Note that in eBGP, the neighbor router should be directly connected in a layer 3 connection.

Continuing from the previous step, the command to be added on R1 to define R2 as the neighbor is:

R1(config-router)#neighbor 10.12.12.2 remote-as 65532
R1(config-router)#

On the other hand, the command on R2 is simply just the reversal of the above:

R2(config-router)#neighbor 10.12.12.1 remote-as 65531
R2(config-router)#

A message similar to below example will appear on each router, indicating that BGP peering is now established:

R1(config-router)#
*May 15 00:02:39.135: %BGP-5-ADJCHANGE: neighbor 10.12.12.2 is up

Once again, note that it may take 10-20 seconds of time for BGP peering to come up.

3. Advertising known routes to the peer AS

Unlike IGP routing, BGP does not automatically exchanging its routing table. The administrator needs to define which route on each router that it wants to advertise. In eBGP configuration, a router can only advertise known routes on its own AS (to advertise routes learned from another AS, use iBGP configuration).

The command to advertise the route is network [address] mask [subnet_mask] and is entered under BGP routing configuration mode. Below is the example configuration on R1:

R1(config-router)#network 172.16.1.0 mask 255.255.255.0
R1(config-router)#network 172.17.1.0 mask 255.255.255.0

Then, below is the example configuration on R2:

R2(config-router)#network 192.168.2.0 mask 255.255.255.0

With this, all subnet in each AS can now reach the subnet in neighbor AS.

4. Verification

After following the steps to configure eBGP in Cisco IOS router as above, the final configuration on each router should look like this:

R1#show run | begin router bgp
router bgp 65531
 no synchronization
 bgp log-neighbor-changes
 network 172.16.1.0 mask 255.255.255.0
 network 172.17.1.0 mask 255.255.255.0
 neighbor 10.12.12.2 remote-as 65532
 no auto-summary
!
R2#show run | begin router bgp
router bgp 65532
 no synchronization
 bgp log-neighbor-changes
 network 192.168.2.0 mask 255.255.255.0
 neighbor 10.12.12.1 remote-as 65531
 no auto-summary
!

Finally, we can verify reachability from each subnet by using ping test. For example:

R1#ping 192.168.2.1 source 172.16.1.1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.2.1, timeout is 2 seconds:
Packet sent with a source address of 172.16.1.1
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 16/28/48 ms
R1#
R1#ping 192.168.2.1 source 172.17.1.1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.2.1, timeout is 2 seconds:
Packet sent with a source address of 172.17.1.1
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 20/29/36 ms

Working with eBGP

When working with eBGP, administrator can use all BGP commands such as show ip bgp summary to see the detail of eBGP configuration. The output of this command shows important information such as router identifier, the AS number where the router is belong to, number of network and path entries, the memory consumes by BGP process, and also information about peer router including neighbor AS number, the peering statestatistics, and number of the prefix or route received from each peer router.

For example:

R2#show ip bgp summary
BGP router identifier 10.12.12.2, local AS number 65532
BGP table version is 15, main routing table version 15
3 network entries using 351 bytes of memory
3 path entries using 156 bytes of memory
3/2 BGP path/bestpath attribute entries using 372 bytes of memory
1 BGP AS-PATH entries using 24 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
BGP using 903 total bytes of memory
BGP activity 8/5 prefixes, 8/5 paths, scan interval 60 secs

Neighbor        V     AS    MsgRcvd MsgSent TblVer InQ OutQ Up/Down  State/PfxRcd
10.12.12.1      4  65531         64      56     15   0    0 00:52:01        2

On the first line of the above output, R2 router identifier is 10.12.12.2 and it is taken from its interface IP address. Also, as configured in BGP configuration, the AS number where R2 is belong to is AS 65532. The next line tells about the statistics of the currently running BGP process in R2. Then, the last line is telling that R2 currently peering with 10.12.12.1 (or in this case is R1 router identifier) from AS 65531 which makes this as an eBGP connection because R2 is peering with neighbor from different AS number. Notice the State/PfxRcd value, if it says anything other than a number then BGP peering is either not completely established yet or there is a problem in the peering. There is number 2 here, means R2 peering with R1 is working as expected, and there are two routes received from the neighbor or in this case is R1.

To see what are the routes received from the neighbor, use command show ip bgp

R2#show ip bgp
BGP table version is 15, local router ID is 10.12.12.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

Network             Next Hop            Metric LocPrf Weight Path
*> 192.168.2.0/24   0.0.0.0                  0         32768 i
*> 172.16.1.0/24    10.12.12.1               0             0 65531 i
*> 172.17.1.0/24    10.12.12.1               0             0 65531 i
R2#

The route entry with next hop value 0.0.0.0 and path “i” means are route that coming from the router itself, and the rest are routes coming from the neighbor. On the output above, we know that routes to 172.16.1.0/24 and 172.17.1.0/24 are coming from eBGP peering between R2 and R1, because the next hop address is R1 IP address and the path is “65531 i” which means the route is exist on AS 65531 which is outside the AS of R2.

And that’s how you configure eBGP in Cisco IOS router.