BGP Multipath load sharing iBGP and eBGP

Unlike most routing protocols, BGP only selects a single best path for each prefix. It doesn’t do ECMP (Equal Cost Multi-Path Routing) by default, but it is possible to enable this.

For BGP to use the second path, the following attributes have to match:

Also, the next hop address for each path must be different. This comes into play when you are multihomed to the same router.

In this lesson, I’ll show you how to configure eBGP and iBGP to use more than one path.

Configuration

We’ll start with two eBGP scenarios.

eBGP

When it comes to eBGP, there are two options:

  • Multiple paths to the same AS.
  • Multiple paths to different ASes.

Same AS





Let’s look at a scenario where we have two paths to the same AS. Here’s the topology:

Bgp As1 As23 Three Routers

R1 is in AS 1  and connected to R2/R3 in AS23. R1 will have paths to get to 192.168.23.0/24.

Configurations

Want to take a look for yourself? Here you will find the startup configuration of each device.

R1

hostname R1
!
ip cef
!
interface GigabitEthernet0/1
 ip address 192.168.12.1 255.255.255.0
!
interface GigabitEthernet0/2
 ip address 192.168.13.1 255.255.255.0
!
router bgp 1
 neighbor 192.168.12.2 remote-as 23
 neighbor 192.168.13.3 remote-as 23
!
end

R2

hostname R2
!
ip cef
!
interface GigabitEthernet0/1
 ip address 192.168.12.2 255.255.255.0
!
interface GigabitEthernet0/2
 ip address 192.168.23.2 255.255.255.0
!
router bgp 23
 network 192.168.23.0 mask 255.255.255.0
 neighbor 192.168.12.1 remote-as 1
 neighbor 192.168.23.3 remote-as 23
!
end

R3

hostname R3
!
ip cef
!
interface GigabitEthernet0/1
 ip address 192.168.13.3 255.255.255.0
!
interface GigabitEthernet0/2
 ip address 192.168.23.3 255.255.255.0
!
router bgp 23
 neighbor 192.168.13.1 remote-as 1
 neighbor 192.168.23.2 remote-as 23
!
end

Here’s the BGP table of R1:

R1#show ip bgp 
BGP table version is 2, local router ID is 192.168.13.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, 
              t secondary path, 
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 *    192.168.23.0     192.168.13.3                           0 23 i
 *>                    192.168.12.2             0             0 23 i

R1 has two equal paths but decided to install the path to R2. We can enable load balancing with the maximum-paths command:

R1(config)#router bgp 1
R1(config-router)#maximum-paths 2

Let’s take another look at the BGP table:

R1#show ip bgp 
BGP table version is 3, local router ID is 192.168.13.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, 
              t secondary path, 
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 *m   192.168.23.0     192.168.13.3                           0 23 i
 *>                    192.168.12.2             0             0 23 i

Now we have two entries. Note the “m” that stands for multipath. Both paths are installed in the routing table:

R1#show ip route bgp

B     192.168.23.0/24 [20/0] via 192.168.13.3, 00:13:02
                      [20/0] via 192.168.12.2, 00:13:02

That’s looking good.

Different AS





Let’s look at another eBGP scenario. This time, we have multiple AS numbers:

Bgp As 1 To 4

R1 can go through AS 3 or AS 2 to get to 4.4.4.4/32 in AS 4.

Configurations

Want to take a look for yourself? Here you will find the startup configuration of each device.

R1

hostname R1
!
ip cef
!
interface GigabitEthernet0/1
 ip address 192.168.12.1 255.255.255.0
!
interface GigabitEthernet0/2
 ip address 192.168.13.1 255.255.255.0
!
router bgp 1
 neighbor 192.168.12.2 remote-as 2
 neighbor 192.168.13.3 remote-as 3
!
end

R2

hostname R2
!
ip cef
!
interface GigabitEthernet0/1
 ip address 192.168.12.2 255.255.255.0
!
interface GigabitEthernet0/2
 ip address 192.168.24.2 255.255.255.0
!
router bgp 2
 neighbor 192.168.12.1 remote-as 1
 neighbor 192.168.24.4 remote-as 4
!
end

R3

hostname R3
!
ip cef
!
interface GigabitEthernet0/1
 ip address 192.168.13.3 255.255.255.0
!
interface GigabitEthernet0/2
 ip address 192.168.34.3 255.255.255.0
!
router bgp 3
 neighbor 192.168.13.1 remote-as 1
 neighbor 192.168.34.4 remote-as 4
!
end

R4

hostname R4
!
ip cef
!
interface Loopback0
 ip address 4.4.4.4 255.255.255.255
!
interface GigabitEthernet0/1
 ip address 192.168.24.4 255.255.255.0
!
interface GigabitEthernet0/2
 ip address 192.168.34.4 255.255.255.0
!
router bgp 4
 network 4.4.4.4 mask 255.255.255.255
 neighbor 192.168.24.2 remote-as 2
 neighbor 192.168.34.3 remote-as 3
!
end

Here’s the BGP table of R1:

R1#show ip bgp
BGP table version is 2, local router ID is 192.168.13.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, 
              t secondary path, 
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 *    4.4.4.4/32       192.168.13.3                           0 3 4 i
 *>                    192.168.12.2                           0 2 4 i

R1 has installed R2 as its next hop address. Let’s see if we can change that:

R1(config)#router bgp 1
R1(config-router)#maximum-paths 2

This command alone, however, doesn’t help:

R1#show ip bgp
*Mar 21 11:10:13.118: %SYS-5-CONFIG_I: Configured from console by console
BGP table version is 2, local router ID is 192.168.13.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, 
              t secondary path, 
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 *    4.4.4.4/32       192.168.13.3                           0 3 4 i
 *>                    192.168.12.2                           0 2 4 i

The problem here is that we have two different AS numbers, AS 2 and AS 3. We can tell BGP to “relax” its requirement of having the same AS path numbers and AS path length to only checking the AS path length. This can be done with the following hidden command:

We're Sorry, Full Content Access is for Members Only...

If you like to keep on reading, Become a Member Now!

  • Learn any CCNA, CCNP and CCIE R&S Topic. Explained As Simple As Possible.
  • Try for Just $1. The Best Dollar You’ve Ever Spent on Your Cisco Career!
  • Full Access to our 800 Lessons. More Lessons Added Every Week!
  • Content created by Rene Molenaar (CCIE #41726)
530 Sign Ups in the last 30 days
satisfaction-guaranteed

  • 100% Satisfaction Guaranteed!
  • You may cancel your monthly membership at any time.
  • No Questions Asked!

Tags:


Forum Replies

  1. still multipath is not enabling. below is the config.

    R1#show run | section bgp
    router bgp 1
     neighbor 192.168.12.2 remote-as 23
     neighbor 192.168.13.3 remote-as 23
     maximum-paths 2
     no auto-summary
    

    BGP Table:

    R1#show ip bgp
        BGP table version is 2, local router ID is 192.168.13.1
        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.23.0     192.168.13
    ... Continue reading in our forum

  2. Hi Pavan,

    That is interesting. What IOS version do you have? The version you see is the version number of the BGP table, not BGP itself.

    Rene

  3. Hi Rene,

    Some confusion please clarify the below sentence:

    We can tell BGP to “relax” its requirement of having the same AS path numbers and AS path length to only checking the AS path length and "AS Path (both AS number and AS path length)

    So, If only AS-PATH is identical/same length then we can do BGP load sharing right ?

    br//zaman

  4. Hi Zaman,

    By default, BGP doesn’t want to load balance over two paths if the AS number is not the same. However, when you add thebgp bestpath as-path multipath-relax command then we remove that requirement. The only thing that remains is that the AS path length has to be the same.

    Rene

  5. Hi,
    What will happen to return traffic from r2 or r3 to r1 in single AS case
    thanks

48 more replies! Ask a question or join the discussion by visiting our Community Forum