How to configure eBGP on Cisco Router

BGP is an exterior gateway protocol that manages how packets are routed across the internet. It can quickly adapt to send out packets if a path goes down. Because of the variety of ways to do the traffic engineering, this is one of the most popular routing protocols.

A series of articles will be published on BGP from basic to advance. Below are the list, which will be updated day by day.

In this lesson, we will learn how to configure eBGP on Cisco Router. Before going into details, let’s check a few terms related to BGP.

Advertisements

Types: There are two types of BGP. These are eBGP and iBGP. eBGP used when we need to connect with external AS number and iBGP when with same AS number. In this article we will configure eBGP.

Autonomous system (AS): A collection of prefixes which are managed by same administrator is called Autonomus system.

Configuring eBGP:

How to configure eBGP on Cisco Router

First of all, let’s configure IP addresing on router R1 and R2.

R1:
R1(config)#interface gigabitEthernet 0/0
R1(config-if)#description **Connected to R2**
R1(config-if)#ip address 1.1.1.1 255.255.255.252
R1(config-if)#no shutdown
R1(config-if)#exit
R1(config)#

R1(config)#interface gigabitEthernet 0/1
R1(config-if)#description **LAN**
R1(config-if)#ip address 10.1.1.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#exit
R1(config)#
R2:
R2(config)#interface gigabitEthernet 0/0
R2(config-if)#description **Connected to R1**
R2(config-if)#ip address 1.1.1.2 255.255.255.252
R2(config-if)#no shutdown
R2(config-if)#exit
R2(config)#

R2(config)#interface gigabitEthernet 0/1
R2(config-if)#description **LAN**
R2(config-if)#ip address 10.2.2.1 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#exit
R2(config)#

Now, let’s move to the eBGP part. We need to configure AS number, and then we need to add our bgp peer IP and it’s AS number as our neighbor, just like below.

R1:
R1(config)#router bgp 100
R1(config-router)#neighbor 1.1.1.2 remote-as 200

R2:
R2(config)#router bgp 200
R2(config-router)#neighbor 1.1.1.1 remote-as 100

After configuring above, you will see a log message on CLI screen saying-

Advertisements
*Sep  7 17:09:26.053: %BGP-5-ADJCHANGE: neighbor 1.1.1.1 Up

This mean, we have successfully configured our BGP. We can verify it by using “show ip bgp summary” command.

R1#show ip bgp summary
BGP router identifier 10.1.1.1, local AS number 100
BGP table version is 1, main routing table version 1

Neighbor        V       AS   MsgRcvd  MsgSent   TblVer  InQ   OutQ Up/Down  State/PfxRcd
1.1.1.2        4     200      17                17        1    0    0    00:12:31        0
R1#

If we want to see more details about our bgp peer we can use “show ip bgp neighbors {neighbors_IP}”.

R1#show ip bgp neighbors 1.1.1.2
BGP neighbor is 1.1.1.2,  remote AS 200, external link
  BGP version 4, remote router ID 10.2.2.1
  BGP state = Established, up for 00:03:44
  Last read 00:00:39, last write 00:00:48, hold time is 180, keepalive interval is 60 seconds
  Neighbor sessions:
    1 active, is not multisession capable (disabled)
  Neighbor capabilities:
    Route refresh: advertised and received(new)
    Four-octets ASN Capability: advertised and received
    Address family IPv4 Unicast: advertised and received
    Enhanced Refresh Capability: advertised and received
    Multisession Capability:
    Stateful switchover support enabled: NO for session 1

It’s clearly showing that our ebgp peer with 1.1.1.2 is in “Established” states (learn about the bgp state from ciscopress) and up for last 00:03:44.

Although, our bgp peer is up, but we will not be able to reach 10.2.2.0/24 network from R1. It’s because we still didn’t declier network in any routers. So, let’s declier our networks.

R1:
R1(config)#router bgp 100
R1(config-router)#network 10.1.1.0 mask 255.255.255.0

R2:
R2(config)#router bgp 200
R2(config-router)#network 10.2.2.0 mask 255.255.255.0

If we use “show ip bgp summary” command once again, we will see 1 prefix is received.

R1#show ip bgp summary
BGP router identifier 10.1.1.1, local AS number 100
BGP table version is 3, main routing table version 3
2 network entries using 288 bytes of memory
2 path entries using 160 bytes of memory
2/2 BGP path/bestpath attribute entries using 304 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 776 total bytes of memory
BGP activity 2/0 prefixes, 2/0 paths, scan interval 60 secs

Neighbor        V       AS   MsgRcvd  MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
1.1.1.2           4     200      13        13          3     0     0   00:08:46          1

We can check which prefixes we have advertised or received by using below commands.

show ip bgp neighbors 1.1.1.2 advertised-routes
show ip bgp neighbors 1.1.1.2 received-routes

Let’s check, what we have advertised.

R1#show ip bgp neighbors 1.1.1.2 advertised-routes
BGP table version is 3, local router ID is 10.1.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 *>  10.1.1.0/24      0.0.0.0                  0         32768 i

Total number of prefixes 1

Now, time to check received routes. However, if we do not have “soft reconfiguration inbound” configured in our router. We will see a error message, says

R1#show ip bgp neighbors 1.1.1.2 received-routes
% Inbound soft reconfiguration not enabled on 1.1.1.2

To solve this, we need to configure below –

R1(config)#router bgp 100
R1(config-router)#neighbor 1.1.1.2 soft-reconfiguration inbound

It will work now. Let’s verify.

R1#show ip bgp neighbors 1.1.1.2 received-routes
BGP table version is 3, local router ID is 10.1.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 *>  10.2.2.0/24      1.1.1.2                  0             0 200 i

Total number of prefixes 1

Finally, lets ping from 10.1.1.0/24 network to 10.2.2.0/24 network.

PC-1> ping 10.2.2.10
84 bytes from 10.2.2.10 icmp_seq=1 ttl=62 time=28.496 ms
84 bytes from 10.2.2.10 icmp_seq=2 ttl=62 time=6.338 ms
84 bytes from 10.2.2.10 icmp_seq=3 ttl=62 time=5.665 ms
84 bytes from 10.2.2.10 icmp_seq=4 ttl=62 time=4.681 ms
84 bytes from 10.2.2.10 icmp_seq=5 ttl=62 time=39.395 ms

Sure enough, we have configure eBGP in our network.

Leave a Comment

Your email address will not be published. Required fields are marked *

2 thoughts on “How to configure eBGP on Cisco Router”

Scroll to Top