ロードバランサで有名なA10ネットワークス社のThunder シリーズ のサーバ負荷分散設定と動作を確認します。今回は、レイヤ4の負荷分散として、Thunderで公開している仮想アドレス(VIP)宛にHTTPアクセスし、2台のWebサーバへラウンドロビンで、ロードバランスさせます。

ThunderのCLIは、Ciscoライクで、非常に設定がしやすいです。今回は、GUIとCLIの両方で、設定と動作確認する方法を確認します。
負荷分散設定
GUI 設定
リアルサーバ(Server)設定
まず、リアルサーバとして、2台のWebサーバを登録します。リアルサーバでは、サーバのIPアドレスとポート番号(今回は、Webサーバとして、TCP80番ポート)を登録します。

ADC >> SLB >> Servers >> Create をクリックします。

下記画面で、リアルサーバを設定します。
- Name:任意の名前。Web-01とします。
- Host:IPアドレスを設定。10.0.200.100 とします。
ポート番号を設定するため、Createをクリックします。

下記画面で、リアルサーバに対して接続されるポート番号を指定します。
- Port or Port Range : ポート番号を指定します。今回は、HTTPのため80を設定します。
- Protocol :TCPとUDPを選択できます。TCPを選択します。
設定後、Createをクリックします。

下記のとおり、Web-01が登録されます。Statusが緑マークとなっており、ヘルスチェックが成功していることが確認できます。

同様の手順でWeb-02も登録します。

サービスグループ(Service-Group)設定
サービスグループによりリアルサーバをグループ化します。このグループ化されたサーバ群に対して、ロードバランシングが実行されます。

ADC >> SLB >> Service Groups >> Create をクリックします。

下記画面で、サービスグループを設定します。
- Name: 任意の名前。sg-webとします。
- Protocol : TCP UDPより選択。TCPを選択します。
- Algorithm:ロードバランス方式を選択。Round Robinを選択します。
設定後、Createをクリックします。

サービスグループの所属するリアルサーバを選択します。
- Server : リアルサーバであるWeb-01を選択
- Port:リアルサーバのポート番号である80を設定
設定後、Createをクリックします。

Updateをクリックします。

下記のとおり、sg-webにリアルサーバWeb-01が登録されます。

Web-02も同様の手順で登録します。

バーチャルサーバ(Virtual Server)の設定
クライアントの接続を受け付けるバーチャルサーバを設定し、サービスグループへ紐付けます。

ADC >> SLB >> Virtual Servers >> Create をクリックします。

下記画面で、バーチャルサーバを設定します。
- Name : バーチャルサーバの名前。今回は、vip-webとします。
- IP Address :バーチャルサーバのIPアドレス。10.0.10.200とします。
設定後、Createをクリックします。

バーチャルサーバで受け付けるL4プロトコル、ポート番号と紐づけるサービスグループを指定します。
- Protocol:TCPを選択します。
- Port or Port Range : バーチャルサーバの受付ポート。80を設定します。
- Service Group :紐づけるサービスグループを指定。sg-webを選択します。
設定後、Createをクリックします。

Updateをクリックします。

下記のとおり、バーチャルサーバが登録されます。

設定保存
設定保存するため、下記フロッピーディスクマークをクリックします。

CLI 設定
GUIで設定した内容と同等のものをCLIで設定します。
特権・コンフィグレーションモードへの移行
Ciscoルータと同様、enableで特権モードに移り、config terminalでコンフィグレーションモードへ移行します。
vThunder>enable Password: 特権パスワードを入力。デフォルトはパスワードなし vThunder#config terminal vThunder(config)#
リアルサーバ(Server)設定
slb server コマンドでサーバ名とIPアドレスを設定し、その中で、公開するポート番号を設定します。
vThunder(config)#slb server Web-01 10.0.200.100 vThunder(config-real server)# port 80 tcp vThunder(config-real server-node port)#exit vThunder(config-real server)#! vThunder(config-real server)#slb server Web-02 10.0.200.173 vThunder(config-real server)# port 80 tcp vThunder(config-real server-node port)#exit vThunder(config-real server)#exit vThunder(config)#
サービスグループ(Service-Group)設定
slb service-groupコマンドでサービスグループ名とL4プロトコル(TCP/UDP)を設定し、リアルサーバをmemberコマンドで指定します。負荷分散方式は、methodコマンドで設定します。
vThunder(config)#slb service-group sg-web tcp vThunder(config-slb svc group)# method round-robin vThunder(config-slb svc group)# member Web-01 80 vThunder(config-slb svc group-member:80)# member Web-02 80 vThunder(config-slb svc group-member:80)#exit vThunder(config-slb svc group)#exit vThunder(config)#
バーチャルサーバ(Virtual Server)の設定
slb virtual-serverコマンドでバーチャルサーバ名とIPアドレスを設定します。次に、受付ポート番号とL4プロトコルを指定のうえ、サービスグループを紐付けます。
vThunder(config)#slb virtual-server vip-web 10.0.10.200 vThunder(config-slb vserver)# port 80 tcp vThunder(config-slb vserver-vport)#service-group sg-web vThunder(config-slb vserver-vport)#exit vThunder(config-slb vserver)#exit vThunder(config)#
設定保存
再起動後に、設定が消えないよう、write memory で設定を保存します。
vThunder(config)#write memory Building configuration... Write configuration to default primary startup-config [OK] vThunder(config)#
動作確認
クライアントから10.0.10.200へHTTPアクセスすると、Web-01、Web-02 それぞれからラウンドロビンで接続されます。


GUI 確認
リアルサーバの状態確認
ADC >> SLB >> Servers より リアルサーバのステータスを確認できます。Statusが緑マークであると、正常に起動しています。

サービスグループの状態確認
ADC >> SLB >> Service Groups より サービスグループのステータスを確認できます。Statusが緑マークであると、正常に起動しています。

バーチャルサーバの状態確認
ADC >> SLB >> Virtual Servers より バーチャルサーバのステータスを確認できます。Statusが緑マークであると、正常に起動しています。

セッション情報
SLB >> Session より 接続されているセッション情報を表示します。Forwardが端末〜Thunder間、ReverseがServer〜Thunder間を意味します。


CLI 確認
サーバのヘルスモニタ
リアルサーバのヘルスチェック状態は show health stat で確認できます。ICMPとTCPでヘルスチェックされています。StatusがUPであれば、ヘルスチェックが正常に応答しています。
vThunder#show health stat ・・・ IP address Port Health monitor Status Cause(Up/Down) Reason(Up/Down) Retry PIN -------------------------------------------------------------------------------------------------------------------------- 10.0.200.100 default UP 11 /0 @0 ICMP Receive OK 0 0 /0 0 10.0.200.100 80 default UP 20 /0 @0 TCP Verify Connection OK 0 0 /0 0 10.0.200.173 default UP 11 /0 @0 ICMP Receive OK 0 0 /0 0 10.0.200.173 80 default UP 20 /0 @0 TCP Verify Connection OK 0 0 /0 0
リアルサーバの状態確認
show slb server でリアルサーバの接続状態を確認できます。StateがUPであれば、正常に起動しています。
vThunder#show slb server Total Number of Servers configured: 2 Total Number of Services configured: 2 Current = Current Connections, Total = Total Connections Fwd-pkt = Forward packets, Rev-pkt = Reverse packets Service Current Total Fwd-pkt Rev-pkt Peak-conn State --------------------------------------------------------------------------------------- Web-01:80/tcp 2 10 79 47 0 Up Web-01: Total 2 10 79 47 0 Up Web-02:80/tcp 1 9 40 29 0 Up Web-02: Total 1 9 40 29 0 Up
サービスグループの状態確認
show slb service-group でサービスグループのステータスを確認できます。Stateが All UPであれば、すべてのグループ内のサーバは正常に起動しています。
vThunder#show slb service-group
Total Number of Service Groups configured: 1
Current = Current Connections, Total = Total Connections
Fwd-p = Forward packets, Rev-p = Reverse packets
Peak-c = Peak connections
Service Group Name
Service Current Total Fwd-p Rev-p Peak-c
-----------------------------------------------------------------------------------
*sg-web State: All Up
Web-01:80 1 4 22 15 0
Web-02:80 2 3 20 12 0
バーチャルサーバの状態確認
show slb virtual-server でバーチャルサーバのステータスを確認できます。StatusがAll Up であると、すべてのサーバが正常に起動しています。
vThunder#show slb virtual-server
Total Number of Virtual Services configured: 1
Virtual Server Name IP Current Total Request Response Peak
Service-Group Service connection connection packets packets connection
----------------------------------------------------------------------------------------
*vip-web 10.0.10.200 All Up
port 80 tcp 3 7 42 27 0
sg-web 80/tcp 3 7 42 27 0
Total received conn attempts on this port: 7
セッション情報
show session にて接続されているセッション情報を表示します。
vThunder#show session Prot Forward Source Forward Dest Reverse Source Reverse Dest Age Hash Flags Type --------------------------------------------------------------------------------------------------------------------------------------------------- Tcp 126.161.138.201:53550 10.0.10.200:80 10.0.200.100:80 126.161.138.201:53550 120 1 NFe0f0r0 SLB-L4 Total Sessions: 1
ログ情報
show log で、システムログが出力されます。仮想サーバの起動なども確認できます。
vThunder# show log Oct 17 2021 08:17:22 Info [ACOS]:Virtual server vip-web is up Oct 17 2021 08:17:22 Info [ACOS]:Service tcp on virtual server vip-web port 80 is up. Oct 17 2021 08:17:22 Info [HMON]:Service-group sg-web is up. Oct 17 2021 07:54:45 Info [HMON]:SLB server Web-02 (10.0.200.173) TCP port 80 of group sg-web is up (enable). Oct 17 2021 07:53:03 Info [HMON]:SLB server Web-01 (10.0.200.100) TCP port 80 of group sg-web is up (enable). Oct 17 2021 07:30:03 Info [HMON]:SLB server Web-02 (10.0.200.173) port 80 is up (TCP Verify Connection OK) Oct 17 2021 07:29:41 Info [HMON]:SLB server Web-02 (10.0.200.173) is up (ICMP Receive OK) Oct 17 2021 07:26:47 Info [HMON]:SLB server Web-01 (10.0.200.100) port 80 is up (TCP Verify Connection OK) Oct 17 2021 07:22:40 Info [HMON]:SLB server Web-01 (10.0.200.100) is up (ICMP Receive OK)
動作確認(Webサーバ障害時)
Web-01をシャットダウンします。すると、Thunderがヘルスチェックによりサーバ停止を検知し、ロードバランシング対象からWeb-01を除外します。端末からアクセスすると、Web-02のみに接続されます。

GUI 確認
リアルサーバの状態確認
ADC >> SLB >> Servers より リアルサーバのTCP 80が赤マークでダウンしています。

サービスグループの状態確認
ADC >> SLB >> Service Groups より サービスグループのうち、Web-01がダウンしていることが確認できます。サービスグループとしては、動作していますので、緑マークで表示され、グループ内にダウンしているサーバがいれば、右下に赤の下向き矢印が表示されます。

バーチャルサーバの状態確認
ADC >> SLB >> Virtual Servers より バーチャルサーバの緑マークステータスに、右下に赤の下向き矢印が表示されます。

CLI 確認
サーバのヘルスモニタ
リアルサーバのヘルスチェック状態を show health statで確認し、Web-01である10.0.200.100のStatusがDOWNであることが確認できます。
vThunder# show health stat
IP address Port Health monitor Status Cause(Up/Down) Reason(Up/Down) Retry PIN
--------------------------------------------------------------------------------------------------------------------------
10.0.200.100 default DOWN 11 /48 @8 ICMP Receive Error 42 0 /0 0
10.0.200.173 default UP 11 /7 @8 ICMP Receive OK 6 0 /0 0
10.0.200.173 80 default UP 20 /0 @0 TCP Verify Connection OK 0 0 /0 0
リアルサーバの状態確認
show slb server でWeb-01のStateがDownであることが確認できます。
vThunder#show slb server Total Number of Servers configured: 2 Total Number of Services configured: 2 Current = Current Connections, Total = Total Connections Fwd-pkt = Forward packets, Rev-pkt = Reverse packets Service Current Total Fwd-pkt Rev-pkt Peak-conn State --------------------------------------------------------------------------------------- Web-01:80/tcp 0 9 49 32 0 Down Web-01: Total 0 9 49 32 0 Down Web-02:80/tcp 0 8 82 54 0 Up Web-02: Total 0 8 82 54 0 Up
サービスグループの状態確認
show slb service-group でサービスグループのステータスを確認できます。StateがFunctional Up であることが確認できます。All UpがFunctional Upに変わったことで、グループ内の一部がダウンしていることがわかります。
vThunder# show slb service-group
Total Number of Service Groups configured: 1
Current = Current Connections, Total = Total Connections
Fwd-p = Forward packets, Rev-p = Reverse packets
Peak-c = Peak connections
Service Group Name
Service Current Total Fwd-p Rev-p Peak-c
-----------------------------------------------------------------------------------
*sg-web State: Functional Up
Web-01:80 0 9 49 32 0
Web-02:80 0 8 82 54 0
バーチャルサーバの状態確認
show slb virtual-server でStatusがFunctional Up であることが確認できます。
vThunder#show slb virtual-server
Total Number of Virtual Services configured: 1
Virtual Server Name IP Current Total Request Response Peak
Service-Group Service connection connection packets packets connection
----------------------------------------------------------------------------------------
*vip-web 10.0.10.200 Functional Up
port 80 tcp 0 17 131 86 0
sg-web 80/tcp 0 17 131 86 0
Total received conn attempts on this port: 17
ログ情報
show log で、Web-01がダウンしていることが確認できます。
vThunder# show log Oct 30 2021 14:45:01 Info [HMON]:SLB server Web-01 (10.0.200.100) is down (ICMP Timeout) Oct 30 2021 14:44:51 Info [HMON]:SLB server Web-01 (10.0.200.100) TCP port 80 of group sg-web is down (health-check). Oct 30 2021 14:44:51 Info [HMON]:SLB server Web-01 (10.0.200.100) port 80 is down (TCP Timeout)
その他
リアルサーバへ負荷分散する際に、送信元NATする場合は、下記の記事を参考にしてください。
>> 参考記事 : サーバ負荷分散(L4) 送信元NATと動作確認 5.2.0
コメント