BGP MULTIPATH LOAD BALANCING

Multipath BGP

While IGPs tend to manage most load balancing scenarios automagicly, BGPs mechanisms are configured manually. To allow multipath eBGP you configure the maximum number of paths to install using the maximum-paths route configuration command. However, multipath route installation does have to meet a few criteria including matching attributes. These attributes include weight, local preference, AS path, origin code, MED, and IGP metric. The next hop address for each path must also be different in order for that path to be considered.
Although the BGP path selection algorithm only considers the AS path length when comparing paths, the actual values (ASNs) of the path attribute have to match for the two routes to be installed
These stipulations are fine when sharing a load across multiple routes to a single ISP. But what if we had two different ISPs? Our attributes may match in every instance, except for the AS numbers in each path. Fortunately, there is an undocumented Cisco command that allows us to consider those routes, despite the differences in the AS numbers inside the path. Introducing bgp bestpath as-path multipath-relax

BGP Multipath Scenario 


R1 MY_Network
R2 - ISP 1
R3 - ISP 2
R4 - Internet
R1 Configuration

interface Loopback0
 ip address 1.1.1.1 255.255.255.255
!
interface Loopback1
 ip address 50.1.1.1 255.255.255.255
!
interface FastEthernet0/0
 no ip address
 shutdown
 duplex half
!
interface FastEthernet1/0
 ip address 10.1.1.1 255.255.255.252
 duplex auto
 speed auto
!
interface FastEthernet1/1
 ip address 20.1.1.1 255.255.255.252
 duplex auto
 speed auto
!
router bgp 65000
 no synchronization
 bgp log-neighbor-changes
 bgp bestpath as-path multipath-relax
 redistribute static
 neighbor 2.2.2.2 remote-as 10
 neighbor 2.2.2.2 ebgp-multihop 2
 neighbor 2.2.2.2 update-source Loopback0
 neighbor 2.2.2.2 default-originate
 neighbor 2.2.2.2 soft-reconfiguration inbound
 neighbor 2.2.2.2 route-map DEFAULT in
 neighbor 3.3.3.3 remote-as 20
 neighbor 3.3.3.3 ebgp-multihop 2
 neighbor 3.3.3.3 update-source Loopback0
 neighbor 3.3.3.3 default-originate
 neighbor 3.3.3.3 soft-reconfiguration inbound
 neighbor 3.3.3.3 route-map DEFAULT in
 maximum-paths 2
 no auto-summary
!
ip route 2.2.2.2 255.255.255.255 10.1.1.2
ip route 3.3.3.3 255.255.255.255 20.1.1.2
!
no ip http server
no ip http secure-server
!
ip prefix-list DEFAULT seq 5 permit 0.0.0.0/0
!
route-map DEFAULT permit 10
 match ip address prefix-list DEFAULT

R2 Configuration

interface Loopback0
 ip address 2.2.2.2 255.255.255.255
!
interface FastEthernet0/0
 no ip address
 shutdown
 duplex half
!
interface FastEthernet1/0
 ip address 10.1.1.2 255.255.255.252
 duplex auto
 speed auto
!
interface FastEthernet1/1
 ip address 192.168.1.1 255.255.255.252
 duplex auto
 speed auto
!
router eigrp 10
 redistribute bgp 10 metric 100000 1000 255 1 1500
 network 2.0.0.0
 network 192.168.1.0
 auto-summary
!
router bgp 10
 no synchronization
 bgp log-neighbor-changes
 redistribute static
 redistribute eigrp 10
 neighbor 1.1.1.1 remote-as 65000
 neighbor 1.1.1.1 ebgp-multihop 2
 neighbor 1.1.1.1 update-source Loopback0
 neighbor 1.1.1.1 default-originate
 no auto-summary
!
ip route 1.1.1.1 255.255.255.255 10.1.1.1

R3 Configuration

interface Loopback0
 ip address 3.3.3.3 255.255.255.255
!
interface FastEthernet0/0
 no ip address
 shutdown
 duplex half
!
interface FastEthernet1/0
 ip address 20.1.1.2 255.255.255.252
 duplex auto
 speed auto
!
interface FastEthernet1/1
 ip address 192.168.1.6 255.255.255.252
 duplex auto
 speed auto
!
router eigrp 10
 redistribute bgp 20 metric 100000 100 255 1 1500
 network 3.0.0.0
 network 192.168.1.0
 auto-summary
!
router bgp 20
 no synchronization
 bgp log-neighbor-changes
 redistribute static
 redistribute eigrp 10
 neighbor 1.1.1.1 remote-as 65000
 neighbor 1.1.1.1 ebgp-multihop 2
 neighbor 1.1.1.1 update-source Loopback0
 neighbor 1.1.1.1 default-originate
 no auto-summary
!
ip route 1.1.1.1 255.255.255.255 20.1.1.1

R4 Configuration

interface Loopback0
 ip address 8.8.8.8 255.255.255.255
!
interface FastEthernet0/0
 no ip address
 shutdown
 duplex half
!
interface FastEthernet1/0
 ip address 192.168.1.5 255.255.255.252
 duplex auto
 speed auto
!
interface FastEthernet1/1
 ip address 192.168.1.2 255.255.255.252
 duplex auto
 speed auto
!
router eigrp 10
 network 8.0.0.0
 network 192.168.1.0
 auto-summary



R1 My Network Router Output
MY_Network#sh ip bgp
BGP table version is 34, local router ID is 50.1.1.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
*> 0.0.0.0          2.2.2.2                  0             0 10 i
*                   3.3.3.3                  0             0 20 i
*> 2.2.2.2/32       10.1.1.2                 0         32768 ?
*> 3.3.3.3/32       20.1.1.2                 0         32768 ?

MY_Network#sh ip bgp neighbors 2.2.2.2 received-routes
BGP table version is 34, local router ID is 50.1.1.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
*> 0.0.0.0          2.2.2.2                  0             0 10 i
*  1.1.1.1/32       2.2.2.2                  0             0 10 ?
*  2.0.0.0          2.2.2.2             128256             0 10 ?
*  2.2.2.2/32       2.2.2.2                  0             0 10 ?
*  3.0.0.0          2.2.2.2             158720             0 10 ?
*  8.0.0.0          2.2.2.2             156160             0 10 ?
*  192.168.1.0/30   2.2.2.2                  0             0 10 ?
*  192.168.1.0      2.2.2.2              28160             0 10 ?
*  192.168.1.4/30   2.2.2.2              30720             0 10 ?

Total number of prefixes 9


MY_Network#sh ip bgp neighbors 3.3.3.3 received-routes
BGP table version is 34, local router ID is 50.1.1.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
*  0.0.0.0          3.3.3.3                  0             0 20 i
*  1.1.1.1/32       3.3.3.3                  0             0 20 ?
*  2.0.0.0          3.3.3.3             158720             0 20 ?
*  3.0.0.0          3.3.3.3             128256             0 20 ?
*  3.3.3.3/32       3.3.3.3                  0             0 20 ?
*  8.0.0.0          3.3.3.3             156160             0 20 ?
*  192.168.1.0/30   3.3.3.3              30720             0 20 ?
*  192.168.1.0      3.3.3.3              28160             0 20 ?
*  192.168.1.4/30   3.3.3.3                  0             0 20 ?

Total number of prefixes 9

MY_Network#sh ip bgp su
BGP router identifier 50.1.1.1, local AS number 65000
BGP table version is 34, main routing table version 34
10 network entries using 1170 bytes of memory
20 path entries using 1040 bytes of memory
1 multipath network entries and 2 multipath paths
16/3 BGP path/bestpath attribute entries using 1984 bytes of memory
2 BGP AS-PATH entries using 48 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 4242 total bytes of memory
16 received paths for inbound soft reconfiguration
BGP activity 72/62 prefixes, 223/203 paths, scan interval 60 secs

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
2.2.2.2         4    10     224     217       34    0    0 00:27:08        1
3.3.3.3         4    20     174     176       34    0    0 00:27:10        1


MY_Network#sh ip rou
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is 3.3.3.3 to network 0.0.0.0

     1.0.0.0/32 is subnetted, 1 subnets
C       1.1.1.1 is directly connected, Loopback0
     50.0.0.0/32 is subnetted, 1 subnets
C       50.1.1.1 is directly connected, Loopback1
     2.0.0.0/32 is subnetted, 1 subnets
S       2.2.2.2 [1/0] via 10.1.1.2
     3.0.0.0/32 is subnetted, 1 subnets
S       3.3.3.3 [1/0] via 20.1.1.2
     20.0.0.0/30 is subnetted, 1 subnets
C       20.1.1.0 is directly connected, FastEthernet1/1
     10.0.0.0/30 is subnetted, 1 subnets
C       10.1.1.0 is directly connected, FastEthernet1/0
B*   0.0.0.0/0 [20/0] via 3.3.3.3, 00:24:37
                   [20/0] via 2.2.2.2, 00:24:37

Internet Trace from my network
MY_Network#  traceroute 8.8.8.8

Type escape sequence to abort.
Tracing the route to 8.8.8.8

  1 20.1.1.2 [AS 10] 92 msec
    10.1.1.2 [AS 10] 124 msec
    20.1.1.2 [AS 10] 28 msec
  2 192.168.1.2 68 msec
    192.168.1.5 44 msec *

No comments: