ccie blog

BGP Unequal Load Cost Sharing

We are going to make R4 use both links when reaching prefixes on the internet.  25% of the traffic will go via AS2, and 75% of the traffic will go via AS3.  Remember that load sharing is always considered in one direction.  So we are only affecting traffic flowing from AS4 outbound to the internet.

Let’s start by taking a peek on R4’s BGP table for the 100.100.100.0/24 prefix.

R4#sh ip bgp 100.100.100.0
BGP routing table entry for 100.100.100.0/24, version 2
Paths: (2 available, best #2, table Default-IP-Routing-Table)
Multipath: eBGP
Flag: 0x820
  Advertised to update-groups:
     1
  3 1
    34.34.34.1 from 34.34.34.1 (3.3.3.3)
      Origin IGP, localpref 100, valid, external
  2 1
    24.24.24.1 from 24.24.24.1 (2.2.2.2)
      Origin IGP, localpref 100, valid, external, best

You can see that R4 is preferring the path via R2 (2.2.2.2) to reach this prefix.  This is because of a lower router-id (i configured #bgp bestpath compare-routerid).  First off, let’s start by making R4 use both paths.

R4(config)#router bgp 4
R4(config-router)# maximum-paths 2  

R4#sh ip bgp 100.100.100.0
BGP routing table entry for 100.100.100.0/24, version 2
Paths: (2 available, best #2, table Default-IP-Routing-Table)
Multipath: eBGP
Flag: 0x820
  Advertised to update-groups:
     1
  3 1
    34.34.34.1 from 34.34.34.1 (3.3.3.3)
      Origin IGP, localpref 100, valid, external
  2 1
    24.24.24.1 from 24.24.24.1 (2.2.2.2)
      Origin IGP, localpref 100, valid, external, best

What’s happened  here is that the AS_PATH’s, although equal length, are not identical.  This means we are still only using one of the available links.  To fix this, we just need to use the hidden command shown below.

R4(config)#router bgp 4
R4(config-router)#bgp bestpath ?
  compare-routerid  Compare router-id for identical EBGP paths
  cost-community    cost community
  med               MED attribute   

R4(config-router)#bgp bestpath as-path multipath-relax   

R4#sh ip bgp  100.100.100.0
BGP routing table entry for 100.100.100.0/24, version 3
Paths: (2 available, best #2, table Default-IP-Routing-Table)
Multipath: eBGP
Flag: 0x800
  Advertised to update-groups:
     1
  3 1
    34.34.34.1 from 34.34.34.1 (3.3.3.3)
      Origin IGP, localpref 100, valid, external, multipath
  2 1
    24.24.24.1 from 24.24.24.1 (2.2.2.2)
      Origin IGP, localpref 100, valid, external, multipath, best   

R4#show ip route 100.100.100.0
Routing entry for 100.100.100.0/24
  Known via "bgp 4", distance 20, metric 0
  Tag 2, type external
  Last update from 34.34.34.1 00:00:26 ago
  Routing Descriptor Blocks:
    34.34.34.1, from 34.34.34.1, 00:00:26 ago
      Route metric is 0, traffic share count is 1
      AS Hops 2
      Route tag 2
  * 24.24.24.1, from 24.24.24.1, 00:57:32 ago
      Route metric is 0, traffic share count is 1
      AS Hops 2
      Route tag 2

The multipath attribute in the BGP table indicates we are now using multiple paths to reach this prefix. The routing table confirms this.  All that’s left now, is to do some unequal load sharing.  Here’s how we do it.

R4(config)#int fa0/0
R4(config-if)#bandwidth 30720
R4(config-if)#int fa0/1
R4(config-if)#bandwidth 10240
R4(config-if)#
R4(config-if)#router bgp 4
R4(config-router)#bgp dmzlink-bw
R4(config-router)#neighbor 24.24.24.1 dmzlink-bw
R4(config-router)#neighbor 34.34.34.1 dmzlink-bw
R4(config-router)#end   

R4#sh ip bgp 100.100.100.0
BGP routing table entry for 100.100.100.0/24, version 5
Paths: (2 available, best #2, table Default-IP-Routing-Table)
Multipath: eBGP
Flag: 0x8000
  Advertised to update-groups:
     1
  3 1
    34.34.34.1 from 34.34.34.1 (3.3.3.3)
      Origin IGP, localpref 100, valid, external, multipath
      DMZ-Link Bw 3840 kbytes
  2 1
    24.24.24.1 from 24.24.24.1 (2.2.2.2)
      Origin IGP, localpref 100, valid, external, multipath, best
      DMZ-Link Bw 1280 kbytes   

R4#sh ip route 100.100.100.0
Routing entry for 100.100.100.0/24
  Known via "bgp 4", distance 20, metric 0
  Tag 2, type external
  Last update from 24.24.24.1 00:01:01 ago
  Routing Descriptor Blocks:
    34.34.34.1, from 34.34.34.1, 00:01:01 ago
      Route metric is 0, traffic share count is 3
      AS Hops 2
      Route tag 2
  * 24.24.24.1, from 24.24.24.1, 00:01:01 ago
      Route metric is 0, traffic share count is 1 
      AS Hops 2
      Route tag 2

The interface bandwidth command is entered in kilobits (which is why the values may have seemed to be a little weird).  Anyhow, you can see from the output of the BGP & RIB table that a portion of the traffic is now shared between R2 and R3.

6 Comments

bperkicJune 11th, 2014 at 9:34 pm

Great post! Thank you!

Raman BishnoiSeptember 16th, 2014 at 4:50 pm

Excellent ……..

lkv_mongolsFebruary 1st, 2015 at 8:48 am

Superb !!!

Mohit TeotiaDecember 3rd, 2015 at 6:02 pm

Really awesome its a very great.

thank you so much for this.

Shailesh JoshiMay 25th, 2016 at 9:26 am

Bull’s eye..Thumbs up..Excellent post without beating around the bush…

MukeshSeptember 13th, 2016 at 12:16 pm

Super !!! Fantastic Post !!!

Thankyou from core of my heart.

God Bless You !!!

Leave a comment

Your comment