CUI/GUI共に初期ログインはadmin:a10
※Thunderには管理専用のマネジメントポートが搭載されており、172.31.31.31/24がデフォルト
負荷分散の構成
ロードバランサの構成はサーバ・クライアント通信経路のスイッチに横付けするワンアーム構成
と、サーバ・クライアントと同じセグメントのアドレスを持たせて経路上で挟み込むツーアーム(インライン)構成
がある。
経路上にLBが存在しない(外付けする)ため、メンテナンスの容易さからワンアーム構成が採用されやすい。
基本動作
ロードバランサは自分の仮想サーバあてのパケットであることを認識し最適なサーバを選択し、サーバにパケットを送出する。
その際にクライアントのソースIPアドレスおよびポート番号はそのままで、宛先IPアドレスおよびポート番号をサーバのものに変換してパケットを送出する。
⇒ Destination(宛先)NAT
が行われていることになる。
一方、サーバからクライアントへの戻りパケットは、ロードバランサによってソースIPアドレス/ポート番号がサーバのものから仮想サーバのものに変換され(戻され)、あて先IPアドレス/ポート番号はそのままでクライアントに到達して通信完了となる。
※このアドレス変換には、ロードバランサの物理インターフェースに割り当てられたIPアドレスは関与しない。
SLB Source NAT
アドレスプールを使用して動的にSource(送信元)NAT。
ワンアームモード、またはLBとサーバがそれぞれ異なるサブネットに属する際、サーバが応答をLB経由で返却しない状態で使用する。
ip nat pool pool1 192.168.1.250 192.168.1.250 netmask /24 ###SNAT用アドレスプール。ここでは1アドレスのみ使用する.
!
health monitor HTTP_80
method http port 80 expect response-code 200 url GET /index.html
!
slb server SERVER1 192.168.1.1 ##VIPに来た通信の送信先を変換するリアルサーバ設定
health-check-disable ##health-checkによりレイヤ3レベルの死活監視を解除
port 80 tcp ##受け付けるアプリケーションのポート番号。0にするとすべて指定。
health-check-disable ##health-checkによりレイヤ4レベルの死活監視を無効化
!
slb server SERVER2 192.168.1.2
health-check-disable
port 80 tcp
health-check-disable
!
slb server SERVER3 192.168.1.3
health-check-disable
port 80 tcp
health-check-disable
!
slb service-group GROUP1 tcp
health-check HTTP_80 ##health-checkによりレイヤ7レベルの死活監視を有効化
min-active-member 1 ##1台になってもサービスを継続する
member SERVER1 SERVER2 SERVER3
!
slb virtual-server V_SERVER1 10.0.1.30 ##クライアントが宛先とするVIPの設定
port 0 tcp
source-nat pool pool1 ##定義したアドレスプールで送信元NAT
service-group GROUP1
各サーバの10.0.1.10向けのルートがLBのアドレスに向いていなかった場合、返りの通信がLBを経由してないため、クライアントからみると宛先に指定したアドレスが送信元になっておらず、パケットを破棄してしまう。
⇒source-nat pool pool1
により、宛先アドレスを変換するとともに送信元アドレスをip nat pool pool1
で定義したプールアドレスへ変換することにより、行きと帰りの通信が同じルートとなりクライアント側での通信の整合性をとる。
※LBが192.168.1.Xのセグメントを持っており、サーバ側からみたnexthopに指定している場合(いわゆるツーアーム構成)では不要。
Layer3 NAT
Dynamic Layer3 NAT
インターナルクライアントが1つもしくは複数のIPアドレスを用いてSource NATを実施
LB(config)# ip nat pool pool1 192.168.1.250 192.168.1.250 netmask /24
LB(config)# access-list 100 permit host 192.168.1.1 any
LB(config)# access-list 100 permit host 192.168.1.2 any
LB(config)# access-list 100 permit host 192.168.1.3 any
LB(config)# ip nat inside source list 100 pool pool1
LB(config)# interface ethernet X
LB(config-if:ethernetX)# ip nat inside
LB(config)# interface ethernet Y
LB(config-if:ethernetY)# ip nat outside
Static Layer3 NAT
サーバに対して固定のIPアドレスを割り当て、Source NATを行う
DinamicNATとStaticNATの両方が設定されている場合は、Staticの設定が優先される。
設定した時点で NAT テーブルに 1 エントリ生成される。
LB(config)# interface ethernet X
LB(config-if:ethernetx)# ip nat inside
LB(config)# interface ethernet Y
LB(config-if:ethernetx)# ip nat outside
LB(config)# ip nat inside source static 192.168.1.1 192.168.1.250
LB(config)# ip nat inside source static 192.168.1.2 192.168.1.250
LB(config)# ip nat inside source static 192.168.1.3 192.168.1.250
insideのIFに入ってくる送信元 192.168.1.1 の IP パケットを、送信元 192.168.1.250 に変換し、outside のインタフェースに入ってきて inside から出ていく宛先 192.168.1.250 を 192.168.1.1 に変換する。
実質、inside destination NAT
と同義となる。
DynamicNAT の場合はそうではなく、必ず inside から outside に抜ける必要がある。
StaticとSourceとDynamicとDestinationがごっちゃになるから略すのはやめろ(白目)
VRRP-A
VRRP-Aは、ACOSに搭載された冗長化機能。
※ルータ冗長化プロトコルVRRPとは全くの別物。VRRP-Aは、以下のリソースについて冗長化を行う。
・バーチャルサーバIPアドレス (ロードバランス対象サービス用のVIP)
・フローティングIPアドレス (筐体インターフェース冗長化用のVIP)
・NATプール
・Source NATのマッピング情報
VRRP-A構成の代表としてトラフィックを処理する機器を"アクティブ機"、アクティブ機が停止した際に通信を引き継ぐ機器を"スタンバイ機"と呼称する。
VRRP-AではVRID
という単位で、上記冗長化対象リソースをグルーピングする。負荷分散対象のサービスごとにVRIDを作成することで、メンテナンス時のフェイルオーバ対象を分離したり、VRIDごとにプライオリティを変更してアクティブ機を分散することができる。
設定例
defaultパーティション
lb01-Active#show partition-config
!Current configuration: 2460 bytes
!Configuration last updated at 17:50:51 JST Tue Nov 21 2023
!Configuration last saved at 17:53:24 JST Tue Nov 21 2023
!64-bit Advanced Core OS (ACOS) version 5.2.1-p4, build 112 (Feb-20-2022,05:33)
!
vrrp-a common ###VRRP-A設定
device-id 1 ###デバイスごとのidを設定。2号機と値を変える
set-id 1 ###VRRP-Aグループで一意のIDを設定
disable-default-vrid ###デフォルトのVRIDを無効化
enable ###VRRP-A有効化
!
access-list 100 permit ip 192.168.60.0 0.0.0.255 any
!
no terminal auto-size
terminal length 0 ###ページング無効
!
ip anomaly-drop drop-all
!
vlan 300 ###VLAN定義(VRRP-A用)
untagged ethernet 3 ###物理IF。ポートVLAN
router-interface ve 300 ###クライアントから通信を受け取る論理IFを指定
name VRRP-A ###冗長名
!
partition part-web id 1 application-type adc ###partition定義。アプリケーションデリバリコントローラ(ADC)とは、サーバの負荷分散装置の一種で、高度な制御機能やサーバ負荷の一部を肩代わりする機能
!
partition part-app id 2 application-type adc
!
hostname lb01
!
timezone Asia/Tokyo nodst
!
ntp server 172.21.0.241
prefer
!
ntp server 172.21.0.242
!
interface management ###管理用IF設定
access-list 100 in
ip address 172.21.245.150 255.255.255.128
ip control-apps-use-mgmt-port
ip default-gateway 172.21.245.254
!
interface ethernet 1
enable
!
interface ethernet 2
enable
!
interface ethernet 3
enable
!
interface ethernet 4
enable
!
interface ethernet 5
enable
!
interface ve 300 ###VE(論理IF)設定。アドレス付与(ciscoでいうところのSVI)
ip address 172.21.0.1 255.255.255.0
!
!
vrrp-a vrid 1 ###VRIDの指定(VRRP-Aで冗長化するグループ作成)
preempt-mode threshold 20
blade-parameters
priority 160 ###Priorityの設定(2号機より高くしておく。デフォルトは150)
tracking-options ###下記IFがdownすると自機のpriority値を減少させる
interface ethernet 1 priority-cost 30 ###サーバ側IFを監視
interface ethernet 2 priority-cost 30 ###クライアント側IFを監視
!
vrrp-a interface ethernet 1 ###VRRP-Aの冗長化管理対象にするIFを設定
server-interface ###サーバ側IF
no-heartbeat ###ハートビート通信を流さない
!
vrrp-a interface ethernet 2
router-interface ###クライアント側IF
no-heartbeat
!
vrrp-a preferred-session-sync-port ethernet 3 ###VRRP-Aのセッション同期用通信を行うIFを指定
!
vrrp-a peer-group ###VRRP-Aのピアグループ設定
peer 172.21.0.2 ###VRRP-Aは、マルチキャストでハートビート通信を行うが、マルチキャストが使えない環境では、ピアグループにハートビートを行うユニキャストIPアドレスを指定。
!
enable-management service ssh
ethernet 3
ve 300
!
enable-management service http
ethernet 3
ve 300
!
enable-management service https
ethernet 3
ve 300
!
enable-management service snmp
ethernet 3
ve 300
!
logging syslog error ###syslog設定
!
logging host 172.21.245.200
!
logging host 172.25.245.200
!
logging buffered 50000
!
sflow setting local-collection
!
sflow collector ip 127.0.0.1 6343 ###sFlowデータを送信するcollectorのIPアドレスとUDPの宛先ポート番号を設定
!
snmp-server enable service
!
snmp-server location LABO
!
snmp-server SNMPv1-v2c user public ###SNMP設定
community read encrypted ZT9jRpxdVm2GsC/KVR0Ht8VJ7CsmhlQEa6o/u/oP7h/XXXXXXXXXXXXXXXXXXXXX
remote 172.21.245.0 255.255.255.0
!
snmp-server enable traps all
!
snmp-server host 172.21.245.210 version v2c community1
!
snmp-server host 172.21.245.211 version v2c community1
!
!
end
webパーティション
lb01-Active#show partition-config part-web
!Current config commit point for partition 0 is 0 & config mode is classical-mode
!Current configuration: 1265 bytes
!Configuration last updated at 19:36:28 JST Mon Jun 12 2023
!Configuration last saved at 19:36:28 JST Mon Jun 12 2023
!
active-partition part-web ###partition設定
!
!
access-list 100 permit tcp any host 2.2.2.3 eq 80 vlan 200
!
access-list 100 permit tcp any host 2.2.2.3 eq 443 vlan 200
!
access-list 100 permit udp host 2.2.2.1 host 2.2.2.2 vlan 200
!
access-list 100 permit udp host 2.2.2.2 host 2.2.2.1 vlan 200
!
access-list 110 permit udp host 10.0.0.1 host 10.0.0.2 vlan 100
!
access-list 110 permit udp host 10.0.0.2 host 10.0.0.1 vlan 100
!
access-list 110 permit icmp host 10.0.0.11 any vlan 100
!
access-list 110 permit icmp host 10.0.0.12 any vlan 100
!
access-list 110 permit tcp host 10.0.0.11 eq 80 any vlan 100
!
access-list 110 permit tcp host 10.0.0.12 eq 80 any vlan 100
!
access-list 110 permit tcp host 10.0.0.11 eq 443 any vlan 100
!
access-list 110 permit tcp host 10.0.0.12 eq 443 any vlan 100
!
vlan 200
untagged ethernet 2
router-interface ve 200
name External
!
vlan 100
untagged ethernet 1
router-interface ve 100
name Internal
!
interface ethernet 1
enable
!
interface ethernet 2
enable
!
interface ve 200
access-list 100 in
ip address 2.2.2.1 255.255.255.0
!
interface ve 100
access-list 110 in
ip address 10.0.0.1 255.255.255.0
!
!
vrrp-a vrid 1
floating-ip 10.0.0.3 ###サーバ側IFのVIP
preempt-mode threshold 20
blade-parameters
priority 160
tracking-options
vlan 200 timeout 30 priority-cost 30 ###VLANで監視
vlan 100 timeout 30 priority-cost 30
!
vrrp-a peer-group
peer 10.0.0.2
peer 2.2.2.2
!
ip route 0.0.0.0 /0 2.2.2.254
!
slb common
extended-stats
graceful-shutdown 30 after-disable
!
health monitor int-web80 #####health-checkの設定を定義。期待値として200 OKが返信されることを設定。service-groupの欄で指定。
method http port 80 expect response-code 200 url GET /index.html
!
health monitor int-web443
method https port 443 expect response-code 200 url GET /index.html
!
slb server websv01 10.0.0.11 ###負荷分散させるリアルサーバ
conn-limit 8000000
slow-start
port 80 tcp
health-check int-web80
port 443 tcp
health-check int-web443
!
slb server websv02 10.0.0.12
conn-limit 8000000
slow-start
port 80 tcp
health-check int-web80 ###health-checkによるレイヤ4レベルの死活監視を指定
port 443 tcp
health-check int-web443
!
slb service-group WEB-GRP-443 tcp ###リアルサーバをまとめるグループ
method src-ip-only-hash
member websv01 443
member websv02 443
!
slb service-group WEB-GRP-80 tcp
method src-ip-only-hash
member websv01 80
member websv02 80
!
slb template virtual-port default
!
slb virtual-server web-VIP 2.2.2.3 ###クライアントはここのVIPが宛先となる。
vrid 1 ###VRIDを指定
port 80 tcp
service-group WEB-GRP-80 ###VIPに来た通信を定義したserver-groupで負荷分散
port 443 tcp
service-group WEB-GRP-443
!
end
appパーティション
lb01-Active#show partition-config part-app
!Current config commit point for partition 1 is 0 & config mode is classical-mode
!Current configuration: 1728 bytes
!Configuration last updated at 20:25:54 JST Tue Nov 21 2023
!Configuration last saved at 20:29:06 JST Tue Nov 21 2023
!
active-partition part-app ###partition設定
!
!
access-list 100 permit tcp any host 100.120.1.3 eq 80 vlan 400
!
access-list 100 permit udp host 100.120.1.1 host 100.120.1.2 vlan 400
!
access-list 100 permit udp host 100.120.1.2 host 100.120.1.1 vlan 400
!
access-list 110 permit tcp host 192.168.1.11 eq 80 any vlan 500
!
access-list 110 permit tcp host 192.168.1.12 eq 80 any vlan 500
!
access-list 110 permit tcp host 192.168.1.13 eq 80 any vlan 500
!
access-list 110 permit udp host 192.168.1.1 host 192.168.1.2 vlan 500
!
access-list 110 permit udp host 192.168.1.2 host 192.168.1.1 vlan 500
!
access-list 110 permit icmp host 192.168.1.11 any vlan 500
!
access-list 110 permit icmp host 192.168.1.12 any vlan 500
!
access-list 110 permit icmp host 192.168.1.13 any vlan 500
!
access-list 110 permit tcp host 192.168.1.11 eq 80 any vlan 3000
!
access-list 110 permit tcp host 192.168.1.12 eq 80 any vlan 3000
!
access-list 110 permit tcp host 192.168.1.13 eq 80 any vlan 3000
!
vlan 500
untagged ethernet 5
router-interface ve 500
name External
!
vlan 400
untagged ethernet 4
router-interface ve 400
name Internal
!
interface ethernet 4
enable
!
interface ethernet 5
enable
!
interface ve 500
access-list 110 in
ip address 192.168.1.1 255.255.255.0
ip nat inside
!
interface ve 400
access-list 100 in
ip address 100.120.1.1 255.255.255.0
!
!
vrrp-a vrid 1
floating-ip 192.168.1.3
preempt-mode threshold 20
blade-parameters
priority 160
tracking-options
vlan 500 timeout 30 priority-cost 30
vlan 400 timeout 30 priority-cost 30
!
vrrp-a peer-group
peer 100.120.1.2
peer 192.168.1.2
!
ip route 0.0.0.0 /0 100.120.1.254
!
ip nat pool nat-pool-set 100.120.1.3 100.120.1.3 netmask /26 ###source-nat用のpool設定
!
ip nat inside source list 110 pool nat-pool-set ###ACL110に来た通信がnatたい
!
slb common
extended-stats
graceful-shutdown 30 after-disable
!
health monitor set-app80
method http port 80 expect response-code 200 url GET /index.html
!
slb server appsv01 192.168.1.11
conn-limit 8000000
slow-start
port 80 tcp
health-check set-app80
!
slb server appsv02 192.168.1.12
conn-limit 8000000
slow-start
port 80 tcp
health-check set-app80
!
slb server appsv03 192.168.1.13
conn-limit 8000000
slow-start
port 80 tcp
health-check set-app80
!
slb service-group SET-GRP-80 tcp
member appsv01 80
member appsv02 80
member appsv03 80
!
slb template virtual-port default
!
slb virtual-server set-app-VIP 100.120.1.3
vrid 1
port 80 tcp
service-group SET-GRP-80
!
sflow collector ip 127.0.0.1 6343
!
end
!Current config commit point for partition 2 is 0 & config mode is classical-mode
基本コマンド
【機器情報】
● バージョン、その他機器情報の確認
# show version
● 本体温度、FAN、電源の状態を確認
# show environment
【リソース】
● 各DataCPUコア毎に利用率を表示
# show cpu
● メモリ利用率を表示
# show memory system
【ネットワーク】
● インターフェース表示
# show interface
【パーティション関連】
● パーティション変更
# configure
(config)# active-partition (パーティション名)
● 現在のパーティションを表示
# show active-partition
【config 関連】
● 設定の表示(現在のパーティションのみ)
# show config
● すべてのパーティションの設定を一括取得
# show partition-config
● コンフィグレーション確認
# show startup-config
# show running-config
● 保存
# write memory
● コンフィグレーション同期
active側で実施する。
(config)# ha sync all to-running-config
(config)# ha sync all to-startup-config
● すべてのパーティションのconfigクリア、aflexや証明書やライセンス情報などもクリアされる
# system-reset
【システム関連】
● システム停止
# shutdown ・・・ システム停止
● 再起動
# reboot ・・・再起動
● ログ表示
# show log・・・ログを表示
【作業、障害時操作】
●ActiveかStandbyかの確認
# show ha
● Active/Standby切り替え
ActiveかStandbyかはプロンプトにも表示される。
コマンドはactive側で実施する。
# configure
(config)# ha force-self-standby
● Active/Standbyの切り戻し
切り戻しはStandby側で先の設定を無効にし、
(config)# no ha force-self-standby
切り替わった新active側で再度下のコマンドを実施する。
(config)# ha force-self-standby
● リアルサーバの組み込み
# configure
(config)# slb server $リアルサーバ名
(config-real server)# enable
● リアルサーバの切り離し
# configure
(config)# slb server $リアルサーバ名
(config-real server)# disable
● コネクション数変更
# configure
(config)# slb server $リアルサーバ名
(config-real server)# conn-limit XXXX
【トラフィック】
● バーチャルサーバ単位での負荷分散ステータスを表示
# show slb virtual-server
※extended-stats キーを入れておかないと過去の統計(最大のトラフィックetc)は見れない
ヘルスチェックのステータス確認にはbindオプションをつけた方が分かりやすい
# show slb virtual-server bind
● サービスグループ単位での負荷分散ステータスを表示
# show slb service-group
● サーバ単位での負荷分散ステータスを表示
# show slb server
● サーバヘルスチェックステータス表示
# show health stat
● インターフェイスのステータスと各種カウンタの表示
# show statistics interface
● SLBセッションのサマリ表示
# show session brief
● パーシステンステーブルの表示
# show session persist src-ip / dst-ip
パーシステンステーブルを削除することもできる。
テーブルを初期化することでトラフィックの偏りなども均質にできる可能性がある。
# clear session persist src-ip / dst-ip
● Arpテーブル表示
# show arp
● MACテーブル表示
# show mac
● IP FIBテーブルを表示
# show ip fib
● IP Rougingテーブル(RIB)を表示
# show ip route
● L2/3 パケット処理のステータス表示
# show slb switch
【デバッグ】
● AXのディスク上の保存されたシステムログの表示
# show log
● その時点のシステム、プロセス関連のステータス情報のスナップショットを出力
# show techsupport
● ログ情報の保存
# backup log ftp://*.*.*.*/ax_backup.tgz
User name []? ****
Password []? ****
※アップロードを行うプルトコルはtftp, ftp, scp, rcp が可能
● パケットキャプチャ
モードを変更する。
# axdebug
キャプチャsするfilterを定義する(絞り込みたい)場合の設定
(axdebug)# filter 1
(axdebug-filter:1)# ip 1.2.3.4 /32
キャプチャするパケット数の定義
ax(axdebug)# count <0-65535>
※デフォルトは3000 パケットまで。0 で設定上の上限なし
キャプチャ時間の定義
(axdebug)# timeout <0-65535>
※分単位で設定。デフォルト5分。0 で設定上の上限なし
キャプチャの開始
(axdebug)# capture non-dispaly save <file name>
キャプチャの状態確認
(axdebug)# show axdebug status
キャプチャファイルの確認
(axdebug)#show axdebug file
キャプチャの停止
(axdebug)# no axdebug
キャプチャファイルのエクスポート
(axdebug)# export axdebug file_name ?
use-mgmt-port Use management port as source port
tftp: Remote file path of tftp: file system(Format: tftp://host/file)
ftp: Remote file path of ftp: file system(Format: ftp://[user@]host[:port]/file)
scp: Remote file path of scp: file system(Format: scp://[user@]host/file)
rcp: Remote file path of rcp: file system(Format: rcp://[user@]host/file)
※キャプチャファイルはpcap形式でZIP圧縮された状態でエクスポート
キャプチャファイルの削除
(axdebug)# delete <file_name>
参考
https://hirotanoblog.com/a10-cli/8396/#toc12
https://rainbow-engine.com/dnat-snat-difference/
https://milestone-of-se.nesuke.com/nw-basic/nat/nat-summary/
https://milestone-of-se.nesuke.com/sv-advanced/appliance-server/load-balancer/