BGP

【図解/BGP】maximum-pathsによるECMP(等コストマルチパス)ロードバランス(シェアリング)設定

BGP で ECMP を実装する方法

BGP では ECMP (Equal Cost Multi Path : 等コストマルチパス) による負荷分散が実装可能ですが、デフォルト設定では有効になっていません。

また、有効にするにも大きく 3 つの形態で設定が異なります。

  1. 同じ AS に対する eBGP のロードバランス
  2. 異なる AS に対する eBGP のロードバランス
  3. iBGP のロードバランス

この記事では上記 3 つのシナリオそれぞれでの設定方法を紹介します。

なお、前提条件として、ロードバランスしたいルートの BGP 属性は、以下記事の『ベストパス選択の優先順位アルゴリズム』の①~⑧までが同じ値である必要があります。

【図解】BGP属性(Path Attribute)とベストパス(経路選択)アルゴリズムの優先順位
BGP 属性(アトリビュート)とカテゴリ BGP では UPDATE メッセージ...

同じ AS に対する eBGP のロードバランス

以下の構成図において、RT2 から RT1 の 1.1.1.0/24 へ行くときのルートを負荷分散 (ロードバランス) します。

この場合、コマンドは maximum-paths 2 だけで OK です。

RT2(config)# router bgp 20
RT2(config-router)# maximum-paths 2

BGP テーブル (show ip bgp) を確認してみます。1.1.1.0/24 の左に multipath を示す m の文字が表示されます。

RT2# show ip bgp
BGP table version is 4, local router ID is 2.2.2.2
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
 *m  1.1.1.0/24       10.1.122.1               0             0 10 i
 *>                   10.1.121.1               0             0 10 i
 *>  2.2.2.0/24       0.0.0.0                  0         32768 i

ルーティングテーブル (show ip route) を見ても、複数ルート表示されていることが分かります。

RT2# show ip route
Codes: L - local, 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, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override, p - overrides from PfR

Gateway of last resort is not set

      1.0.0.0/24 is subnetted, 1 subnets
B        1.1.1.0 [20/0] via 10.1.122.1, 00:01:36
                 [20/0] via 10.1.121.1, 00:01:36
      2.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C        2.2.2.0/24 is directly connected, Loopback0
L        2.2.2.2/32 is directly connected, Loopback0
      10.0.0.0/8 is variably subnetted, 4 subnets, 2 masks
C        10.1.121.0/24 is directly connected, GigabitEthernet0/0
L        10.1.121.2/32 is directly connected, GigabitEthernet0/0
C        10.1.122.0/24 is directly connected, GigabitEthernet0/1
L        10.1.122.2/32 is directly connected, GigabitEthernet0/1

異なる AS に対する eBGP のロードバランス

今度は以下の構成のように、異なる AS に対しての負荷分散を見ていきます。RT4 から RT1 の 1.1.1.0/24 へ行くときのルートをロードシェアリングします。

この場合、コマンドは maximum-paths 2 だけでは足りません。bgp bestpath as-path multipath-relax という隠しコマンドが必要です。( ? やタブ補完では出てきません1)

RT4(config)# router bgp 40
RT4(config-router)# maximum-paths 2
RT4(config-router)# bgp bestpath as-path multipath-relax

これによりルートがロードバランスになります。BGP テーブル (show ip bgp) を見てみます。1.1.1.0/24 の左側に multipath を示す m の文字があります。

RT4# sh ip bgp
BGP table version is 10, local router ID is 4.4.4.4
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
 *m  1.1.1.0/24       10.1.24.2                              0 20 10 i
 *>                   10.1.34.3                              0 30 10 i
 *>  2.2.2.0/24       10.1.24.2                0             0 20 i
 *>  3.3.3.0/24       10.1.34.3                0             0 30 i
 *>  4.4.4.0/24       0.0.0.0                  0         32768 i

ルーティングテーブル (show ip route) でも 2 つのルートが見えます。

RT4# show ip route
Codes: L - local, 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, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override, p - overrides from PfR

Gateway of last resort is not set

      1.0.0.0/24 is subnetted, 1 subnets
B        1.1.1.0 [20/0] via 10.1.34.3, 00:01:51
                 [20/0] via 10.1.24.2, 00:01:51
      2.0.0.0/24 is subnetted, 1 subnets
B        2.2.2.0 [20/0] via 10.1.24.2, 00:03:36
      3.0.0.0/24 is subnetted, 1 subnets
B        3.3.3.0 [20/0] via 10.1.34.3, 00:03:36
      4.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C        4.4.4.0/24 is directly connected, Loopback0
L        4.4.4.4/32 is directly connected, Loopback0
      10.0.0.0/8 is variably subnetted, 4 subnets, 2 masks
C        10.1.24.0/24 is directly connected, GigabitEthernet0/0
L        10.1.24.4/32 is directly connected, GigabitEthernet0/0
C        10.1.34.0/24 is directly connected, GigabitEthernet0/1
L        10.1.34.4/32 is directly connected, GigabitEthernet0/1

iBGP のロードバランス

以下の構成図において、RT6 から RT1 の 1.1.1.0/24 へ行くときのルートをロードバランスします。

iBGP の場合は maximum-paths ibgp 2 もしくは maximum-paths eibgp 2 と設定します。

RT6(config)# router bgp 456
RT6(config-router)# maximum-paths ibgp 2

このようにすると BGP テーブル (show ip bgp) で以下のように m が出力されます。

RT6# show ip bgp
BGP table version is 21, local router ID is 6.6.6.6
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
 *mi 1.1.1.0/24       10.1.56.5                0    100      0 123 i
 *>i                  10.1.46.4                0    100      0 123 i
 *>i 2.2.2.0/24       10.1.46.4                0    100      0 123 i
 *>i 3.3.3.0/24       10.1.56.5                0    100      0 123 i
 *>i 4.4.4.0/24       10.1.46.4                0    100      0 i
 *>i 5.5.5.0/24       10.1.56.5                0    100      0 i
 *>  6.6.6.0/24       0.0.0.0                  0         32768 i

ルーティングテーブル (show ip route) も以下のように出力されます。

RT6# show ip route
Codes: L - local, 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, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override, p - overrides from PfR

Gateway of last resort is not set

      1.0.0.0/24 is subnetted, 1 subnets
B        1.1.1.0 [200/0] via 10.1.56.5, 00:01:59
                 [200/0] via 10.1.46.4, 00:01:59
      2.0.0.0/24 is subnetted, 1 subnets
B        2.2.2.0 [200/0] via 10.1.46.4, 00:02:19
      3.0.0.0/24 is subnetted, 1 subnets
B        3.3.3.0 [200/0] via 10.1.56.5, 00:02:19
      4.0.0.0/24 is subnetted, 1 subnets
B        4.4.4.0 [200/0] via 10.1.46.4, 00:02:19
      5.0.0.0/24 is subnetted, 1 subnets
B        5.5.5.0 [200/0] via 10.1.56.5, 00:02:19
      6.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C        6.6.6.0/24 is directly connected, Loopback0
L        6.6.6.6/32 is directly connected, Loopback0
      10.0.0.0/8 is variably subnetted, 4 subnets, 2 masks
C        10.1.46.0/24 is directly connected, GigabitEthernet0/0
L        10.1.46.6/32 is directly connected, GigabitEthernet0/0
C        10.1.56.0/24 is directly connected, GigabitEthernet0/1
L        10.1.56.6/32 is directly connected, GigabitEthernet0/1

コメント

タイトルとURLをコピーしました