ネットワーク環境

VIP : 172.16.20.80
BIGIP設定イメージ

動作概要
- クライアントがVirtualServerにアクセスすると、WebServer1/Webserver2に負荷分散させるが、cookieをInsertすることによりcookieを保持する間は同じサーバーへ振り分けられるようにする。
- WebServer1/Webserver2の2台ともサービスがダウンしているとソーリーサーバに振り分けを実施する。
- サーバーとHTTPプロセスをヘルスチェックにて死活監視を行う。
前提構成
- BIGIPの初期設定が完了している。
- WebServerとの疎通性がある。
BIGIP設定
Monitor作成
HTTPモニタ作成
Webサーバのサービス監視用モニタ作成
設定:5秒間隔で監視を行い、16秒間応答がない場合(3回連続でNG)はモニターNGとする。
1.Local Traffic ›› MonitorsからCreateをクリックし設定画面を開く。
2.Type:HTTPを選択を行い、各パラメータを入力後に最下部のFinishをクリックし作成を行う。
| Name | monitor_HTTP |
| Type | HTTP |
| Parent Monitor | http |
| Configuration | Basic |
| Interval | 5 |
| Timeout | 16 |
| Send String | GET /index.html HTTP/1.1\r\nHost: host.domain.com\r\nConnection: Close\r\n |
| Receive String | 200 OK |

ICMPモニタ作成
Webサーバのノード監視用モニタ作成
設定:5秒間隔で監視を行い、16秒間応答がない場合(3回連続でNG)はモニターNGとする。
1.Local Traffic ›› MonitorsからCreateをクリックし設定画面を開く。
2.Type:ICMPを選択を行い、各パラメータを入力後に最下部のFinishをクリックし作成を行う
| Name | moniter_ICMP |
| Type | ICMP |
| Parent Monitor | icmp |
| Configuration | Basic |
| Interval | 5 |
| Timeout | 16 |

Profile作成
HTTP Profile作成
HTTPヘッダにX-Forwarded-For情報を追加するためにプロファイル作成
1.Local Traffic ›› Profiles ›› Services ›› HTTPからCreateをクリックし設定画面を開く。
2.右端のチェックボックスにチェックを入れ、X-Forwarded-Forの設定後に最下部のFinishをクリックし作成を行う
| Name | custom_HTTPProfile |
| Insert X-Forwarded-For | Enabled |

cookie Insert用Profile作成
cookieによる同じサーバーへ振り分けを行うためにプロファイル作成
1.Local Traffic ›› Profiles ›› Profiles ›› PersistenceからCreateをクリックし設定画面を開く。
2.以下の設定後に最下部のFinishをクリックし作成を行う。
| Name | custom_cookieProfile |
| Persistence Type |
cookie |

※暗号化等は後述でパケットキャプチャーするため未設定としている。
Nodeデフォルトモニタ変更作成
ノードのデフォルトモニター設定の変更を行う。
1.初期値の private_monitorを削除し monitor_ICMPを追加する。
| Health Monitors | private_monitor ⇒ monitor_ICMP |
private_monitorを選択後 >> で Availableへ移動させる。

Availableから monitor_ICMPを選択し、 << でActiveに移動させる。
そのご、Updateで設定を反映させる。

Pool作成
Local Traffic ›› Pools : Pool List ›› New Pool... に対して以下の設定を行います。
| Name | pool_HTTP |
| Health Monitors | monitor_HTTP |
| Load Balancing Method | Round Robin ※デフォルト |
| Priority Group Activation | Less than.. 2 Available Member(s) |
| New Members | |
| Node Name/Address/Service Port/Priority | Web1 / 172.16.10.110 / 80 / 10 |
| Node Name/Address/Service Port/Priority | Web2 / 172.16.10.120 / 80 / 10 |
| Node Name/Address/Service Port/Priority | Sorry1 / 172.16.10.130 / 80 / 5 |

登録後、nodeとの疎通が問題ない場合は ステータスが"●"の表示となる
Pool状態:Local Traffic ›› Pools : Pool List

Node状態:Local Traffic ›› Pools : Pool List ›› pool_HTTP :membersタブ

※LTMログ /var/log/ltm
# cat /var/log/ltm
Aug 14 08:16:49 bigip01 notice mcpd[4564]: 01070728:5: Node /Common/Sorry1 address 172.16.10.130 monitor status up. [ /Common/monitor_ICMP: up ] [ was unchecked for 0hr:0min:2sec ]
Aug 14 08:16:49 bigip01 notice mcpd[4564]: 01070728:5: Node /Common/Web1 address 172.16.10.110 monitor status up. [ /Common/monitor_ICMP: up ] [ was unchecked for 0hr:0min:2sec ]
Aug 14 08:16:49 bigip01 notice mcpd[4564]: 01070728:5: Node /Common/Web2 address 172.16.10.120 monitor status up. [ /Common/monitor_ICMP: up ] [ was unchecked for 0hr:0min:2sec ]
Aug 14 08:16:49 bigip01 notice mcpd[4564]: 01070727:5: Pool /Common/pool_HTTP member /Common/Sorry1:80 monitor status up. [ /Common/monitor_HTTP: up ] [ was unchecked for 0hr:0min:2sec ]
Aug 14 08:16:49 bigip01 notice mcpd[4564]: 01070727:5: Pool /Common/pool_HTTP member /Common/Web1:80 monitor status up. [ /Common/monitor_HTTP: up ] [ was unchecked for 0hr:0min:2sec ]
Aug 14 08:16:49 bigip01 notice mcpd[4564]: 01070727:5: Pool /Common/pool_HTTP member /Common/Web2:80 monitor status up. [ /Common/monitor_HTTP: up ] [ was unchecked for 0hr:0min:2sec ]
System ›› Logs : Local Traffic

VirtualServer作成
Local Traffic ›› Virtual Servers : Virtual Server List ›› New Virtual Server...に対して以下の設定を行う。
| Name | VS_HTTP |
| Destination Address/Mask | 172.16.20.80 |
| Service Port | 80 |
| Protocol | TCP |
| Protocol Profile (Client) | tcp |
| HTTP Profile | custom_HTTPProfile |
| Default Pool | pool_HTTP |
| Default Persistence Profile | custom_cookieProfile |

Virtual Server状態:Local Traffic ›› Virtual Servers : Virtual Server List

※LTMログ /var/log/ltm
# cat /var/log/ltm
Aug 14 09:24:32 bigip01 notice mcpd[4564]: 01071681:5: SNMP_TRAP: Virtual /Common/VS_HTTP has become available
Aug 14 09:24:32 bigip01 notice mcpd[4564]: 010719e7:5: Virtual Address /Common/172.16.20.80 general status changed from BLUE to GREEN.
System ›› Logs : Local Traffic

動作確認① Cookieパーシステンスの動作
アクセス確認
クライアントからVIPに対してブラウザから複数回連続アクセスを行う。

カウンタ確認
”Statistics ›› Module Statistics : Local Traffic” から”Statistics Type:Pools”から pool_HTTPのカウンタがWebServer1”のみカウントアップしていることが分かる。
connectionsからもWevServer1のみカウントしていることが分かる。

クラアントでのキャプチャー実施結果
1回目以降のアクセス
■HTTPリクエストの内容
cookieの情報が無いこと分かる。

■HTTPレスポンスの内容
Set-Cookieでcookie情報が付与されたことが分かる。

2回目以降のアクセス
■HTTPリクエストの内容
cookieの付与された値が含まれること分かる。

■HTTPレスポンスの内容
Set-Cookieの情報が含まないことが分かる。

動作確認② ロードバランサ機能
アクセス確認
複数のブラウザを使用してアクセスし、WebServer1.WebServer2へアクセスできることを確認する。

動作確認③ XFFの確認
TCPDUMPの準備
BIGIPのInternal側インターフェースに流れるパケットをキャプチャーする。
※ヘルスモニターのパケットもキャプチャーできるのでいい感じでフィルタするか
Wiresharkなどでフィルタして表示させる。
キャプチャー確認
■HTTPリクエスト
ヘッダ情報で、以下のことが確認できた。
・XFFが付与された
・cookieパーシステンスの情報は削除された

■レスポンス

参考ドキュメント
- 作者: トニーブルーク,Tony Bourke,鍋島公章,横山晴庸,上谷一
- 出版社/メーカー: オライリー・ジャパン
- 発売日: 2001/12
- メディア: 単行本
- 購入: 6人 クリック: 195回
- この商品を含むブログ (20件) を見る
- 作者: みやたひろし
- 出版社/メーカー: SBクリエイティブ
- 発売日: 2014/10/05
- メディア: オンデマンド (ペーパーバック)
- この商品を含むブログを見る