キャンセル
次の結果を表示 
次の代わりに検索 
もしかして: 
cancel
9187
閲覧回数
1
いいね!
0
コメント
ryouta_k12a
Level 1
Level 1

 

 

このドキュメントについて

 

このドキュメントでは、 Cisco ルータおける CEF を使用したルーティング時のロードバランシングについて説明しています。

このドキュメントでは、 Cisco 1841 ルータを使用しています。

 

ロードバランシングとは

 

宛先へ複数の経路がある場合に、複数の経路にパケットを分散させて転送することをロードバランシングと呼びます。

Cisco ルータにおけるロードバランシングの特徴は以下のような点です。

  • Cisco IOS の標準機能
  • 転送プロセス固有の機能
  • ダイナミック/スタティックルーティング両方で機能

宛先への AD とコストが同じ複数のパスが存在する場合に、自動的にロードバランシングが生じます。

CEF 以外のスイッチングパスの方式

 

ロードバランシングを設定する際には、ルータにおけるスイッチングパスの方式によってロードバランシングの動作が変わってくるため、このセクションでは CEF 以外の Cisco ルータのスイッチングパスの方式について説明します。

このセクションでは、Cisco ルータが使用するスイッチングパスの方式の中から 以下の 2 つを紹介します。

 

  • プロセススイッチング
  • ファーストスイッチング

プロセススイッチング

 

最も基本的なパケット処理方法です。

プロセススイッチングでは、宛先へ複数の経路がある場合に、パケット単位でのロードバランシングを行います。経路の決定はラウンドロビン方式が使用されます。

この方式ではパケットは複数のパスを交互に通過するため、負荷は均等に分散されます。しかし、パケットが経路を交互に通過するために、受信ホストでパケットの並び替えが発生することがあります。

ファーストスイッチング

 

特定の宛先に送信される、最初のパケットによってキャッシュが作成され、そのキャッシュを使用することで、ルータが素早くパケットを転送できるようになります。

ファーストスイッチングでは、宛先へ複数の経路がある場合に、宛先単位でのロードバランシングを行います。つまり、複数の経路がある場合でも、同一の宛先に対してはいつでも同じ経路を使用することが保証されます。そのため、各径路への負荷が不均等になることがあります。

CEF の説明

ファーストスイッチングがルートキャッシュを使用していたのに対して、 CEF では Forwarding Information Base(FIB) 及び隣接関係テーブルを使用して宛先を決定します。

隣接関係テーブルはレイヤ 3 のアドレスによって参照され、レイヤ 2 の情報が格納されています。FIB は レイヤ 3 アドレスによって参照されるツリー構造をしており、隣接関係テーブルを指し示します。

 

CEF では宛先へ複数の経路がある場合に、以下の 2 つのスイッチング方式を使用することが出来ます。

  • 宛先単位( per-destination )
  • パケット単位( per-packet )

 

 

設定と確認

 

このセクションでは実際に CEF を使用したロードバランシングの設定を行い、確認します。

トポロジ

 

以下のトポロジを使用します。

 

topology.png

 

基本的な設定

 

RouterA

 

    !

    hostname RouterA

    !

    ip cef

    !

    interface FastEthernet0/0

     ip address 192.168.1.254 255.255.255.0

     duplex auto

     speed auto

    !

    interface Serial0/0/0

     ip address 1.1.1.1 255.255.255.252

    !

    interface Serial0/0/1

     ip address 2.2.2.1 255.255.255.252

    !

    !

    no ip http server

    ip route 192.168.2.0 255.255.255.0 1.1.1.2

    ip route 192.168.2.0 255.255.255.0 2.2.2.2

    !

 

RouterB

 

    !

    hostname RouterB

    !

    !

    ip cef

    !

    !

    interface Loopback0

     ip address 192.168.2.254 255.255.255.0

    !

    interface Serial0/0/0

     ip address 1.1.1.2 255.255.255.252

     no ip route-cache

     no fair-queue

     clock rate 125000

    !

    interface Serial0/0/1

     ip address 2.2.2.2 255.255.255.252

     no ip route-cache

     clock rate 125000

    !

    !

    no ip http server

    ip route 192.168.1.0 255.255.255.0 1.1.1.1

    ip route 192.168.1.0 255.255.255.0 2.2.2.1

    !

 

CEF の設定と確認

 

CEF を有効にするには以下のコマンドをコンフィグレーションモードで入力します。

 

    RouterA(config)#ip cef

 

RouterA の Serial0/0/0 と Serial0/0/1 の間で CEF によるロードバランシングが行われることになります。

 

CEF が有効になっているかを確認するためには以下の show コマンドを入力します。

 

    RouterA#show ip interface

    FastEthernet0/0 is up, line protocol is up

    Internet address is 192.168.1.254/24

    Broadcast address is 255.255.255.255

    ...略...

    IP fast switching is enabled

    IP fast switching on the same interface is disabled

    IP Flow switching is disabled

    IP CEF switching is enabled

    IP CEF switching turbo vector

    IP multicast fast switching is enabled

    IP multicast distributed fast switching is disabled

    IP route-cache flags are Fast, CEF

    ...略...

    Serial0/0/0 is up, line protocol is up

    Internet address is 1.1.1.1/30

    Broadcast address is 255.255.255.255

    ...略...

    IP fast switching is enabled

    IP fast switching on the same interface is enabled

    IP Flow switching is disabled

   IP CEF switching is enabled

    IP CEF switching turbo vector

    IP multicast fast switching is enabled

    IP multicast distributed fast switching is disabled

    IP route-cache flags are Fast, CEF

    ...略...

    Serial0/0/1 is up, line protocol is up

    Internet address is 2.2.2.1/30

    Broadcast address is 255.255.255.255

    ...略...

    IP fast switching is enabled

    IP fast switching on the same interface is enabled

    IP Flow switching is disabled

    IP CEF switching is enabled

    IP CEF switching turbo vector

    IP multicast fast switching is enabled

    IP multicast distributed fast switching is disabled

    IP route-cache flags are Fast, CEF

    ...略...

 

CEF が有効になっていることを確認できます。

CEF のスイッチング方式を宛先単位のスイッチングに切り替えるには以下のコマンドを使用します。

 

    (config-if)#ip load-sharing per-destination

 

パケット単位のスイッチングに切り替える時は以下のコマンドです。

 

    (config-if)ip load-sharing per-packet

 

また、以下のコマンドを使用すると、CEF が宛先単位のスイッチングをしているか、パケット単位のスイッチングをしているか確認出来ます。

 

    RouterA#show cef interface

    FastEthernet0/0 is up (if_number 2)

    Corresponding hwidb fast_if_number 2

    Corresponding hwidb firstsw->if_number 2

    Internet address is 192.168.1.254/24

    ICMP redirects are always sent

    Per packet load-sharing is disabled

    IP unicast RPF check is disabled

    IP policy routing is disabled

    BGP based policy accounting on input is disabled

    BGP based policy accounting on output is disabled

    Hardware idb is FastEthernet0/0

    Fast switching type 1, interface type 18

    IP CEF switching enabled

    IP CEF switching turbo vector

    IP prefix lookup IPv4 mtrie 8-8-8-8 optimized

    Input fast flags 0x0, Output fast flags 0x0

    ifindex 2(2)

    Slot  Slot unit 0 VC -1

    IP MTU 1500

    FastEthernet0/1 is down (if_number 3)

    ...略...

    Serial0/0/0 is up (if_number 4)

    Corresponding hwidb fast_if_number 4

    Corresponding hwidb firstsw->if_number 4

    Internet address is 1.1.1.1/30

    ICMP redirects are never sent

    Per packet load-sharing is disabled

    IP unicast RPF check is disabled

    IP policy routing is disabled

    BGP based policy accounting on input is disabled

    BGP based policy accounting on output is disabled

    Interface is marked as point to point interface

    Hardware idb is Serial0/0/0

    Fast switching type 4, interface type 185

    IP CEF switching enabled

    IP CEF switching turbo vector

    IP prefix lookup IPv4 mtrie 8-8-8-8 optimized

    Input fast flags 0x0, Output fast flags 0x0

    ifindex 4(4)

    Slot  Slot unit 0 VC -1

    IP MTU 1500

    Serial0/0/1 is up (if_number 5)

    Corresponding hwidb fast_if_number 5

    Corresponding hwidb firstsw->if_number 5

    Internet address is 2.2.2.1/30

    ICMP redirects are never sent

    Per packet load-sharing is disabled

    IP unicast RPF check is disabled

    IP policy routing is disabled

    BGP based policy accounting on input is disabled

    BGP based policy accounting on output is disabled

    Interface is marked as point to point interface

    Hardware idb is Serial0/0/1

    Fast switching type 4, interface type 185

    IP CEF switching enabled

    IP CEF switching turbo vector

    IP prefix lookup IPv4 mtrie 8-8-8-8 optimized

    Input fast flags 0x0, Output fast flags 0x0

    ifindex 5(5)

    Slot  Slot unit 0 VC -1

    IP MTU 1500

 

パケット単位のロードシェアリングが無効になっていることから、宛先単位のスイッチングをしていることがわかります。

FIB テーブルの全体の内容は以下のコマンドで確認できます。

 

    RouterA#show ip cef

    Prefix               Next Hop             Interface

    0.0.0.0/0            no route

    0.0.0.0/8            drop

    0.0.0.0/32           receive             

    1.1.1.0/30           attached             Serial0/0/0

    1.1.1.0/32           receive              Serial0/0/0

    1.1.1.1/32           receive              Serial0/0/0

    1.1.1.2/32           1.1.1.2              Serial0/0/0

    1.1.1.3/32           receive              Serial0/0/0

    2.2.2.0/30           attached             Serial0/0/1

    2.2.2.0/32           receive              Serial0/0/1

    2.2.2.1/32           receive              Serial0/0/1

    2.2.2.2/32           2.2.2.2              Serial0/0/1

    2.2.2.3/32           receive              Serial0/0/1

    127.0.0.0/8          drop

    192.168.1.0/24       attached             FastEthernet0/0

    192.168.1.0/32       receive              FastEthernet0/0

    192.168.1.1/32       attached             FastEthernet0/0

    192.168.1.254/32     receive              FastEthernet0/0

    192.168.1.255/32     receive              FastEthernet0/0

    192.168.2.0/24       1.1.1.2              Serial0/0/0

                         2.2.2.2              Serial0/0/1

    224.0.0.0/4          drop

    224.0.0.0/24         receive             

    240.0.0.0/4          drop

    255.255.255.255/32   receive             

 

192.168.2.0/24 へは 2つの Next Hop が登録されていることがわかります。

 

CEF 設定時の注意点

 

CEF 使用時には debug ip packet を使用しても何も表示されません。これはパケットがプロセッサに送られないためです。

 

また、Cisco ルータでは着信インターフェースのスイッチング方式によってパケットが辿るスイッチング方式が決定するため注意が必要です。以下の表がそのルールになります。

 

着信インターフェース

 

発信インターフェース

 

 

スイッチング方式

CEF

プロセス CEF
プロセススイッチング CEF ファーストスイッチング
プロセススイッチング ファーストスイッチング

ファーストスイッチング

CEF

ファーストスイッチング CEF

 

上の表からわかる通り、 CEF を使用してロードバランシングを行いたい場合、パケットの着信インターフェースで CEF を有効にする必要があります。

参考ページ

 

このドキュメントは以下のページを参考にしながら作成しました。

 

http://www.cisco.com/cisco/web/support/JP/100/1008/1008001_tuning-j.html#cisco_xpres

http://www.cisco.com/cisco/web/support/JP/100/1007/1007839_cef_whichpath-j.html

http://www.cisco.com/cisco/web/support/JP/102/1021/1021118_loadbal_cef-j.html

Getting Started

検索バーにキーワード、フレーズ、または質問を入力し、お探しのものを見つけましょう

シスコ コミュニティをいち早く使いこなしていただけるよう役立つリンクをまとめました。みなさんのジャーニーがより良いものとなるようお手伝いします