2020-05-09
08:12 PM
- 最終編集日:
2023-12-20
03:49 PM
、編集者:
JapanTAC_CSC
本ドキュメントでは、コネクション数の show コマンドやSNMPポーリングを用いた確認方法と、膨大なコネクションが発生時の問題IPアドレスの確認方法について紹介します。
本ドキュメントは、ASAバージョン 9.12(3)9 を用いて確認、作成しております。
show conn コマンドで、現在のコネクション数と、ピーク時のコネクション数を確認できます。以下の出力例の場合、現在 209のActiveなコネクションがあり、ピーク時は 9722のコネクションがあったことを確認できます。
ASA5555(config)# show conn count 209 in use, 9722 most used
なお、show resource usage コマンドでも、現在のコネクション数と、ピーク時のコネクション数、及び その製品の最大コネクション可能数を確認できます。以下の出力例の場合、現在 204のActiveなコネクションがあり、ピーク時は 9722のコネクションがあり、最大コネクション可能数は 1,000,000 であることを確認できます。
ASA5555(config)# show resource usage Resource Current Peak Limit Denied Context SSH Server 1 2 5 0 System ASDM 0 1 30 0 System Syslogs [rate] 29 3725 N/A 0 System Conns 204 9722 1000000 0 System <-- THIS Xlates 549 3214 N/A 0 System Hosts 436 980 N/A 0 System Conns [rate] 6 2385 N/A 0 System Inspects [rate] 1 1873 N/A 0 System Routes 13 15 unlimited 0 System
OID 1.3.6.1.4.1.9.9.147.1.2.2.2.1 を用いて、現在のコネクション数と、ピーク時のコネクション数を確認できます。MIBは CISCO-FIREWALL-MIB です。
cisco@ubuntu:~$ snmpwalk -v 2c -c cisco123 1.0.0.100 1.3.6.1.4.1.9.9.147.1.2.2.2.1 iso.3.6.1.4.1.9.9.147.1.2.2.2.1.3.40.6 = STRING: "number of connections currently in use by the entire firewall" iso.3.6.1.4.1.9.9.147.1.2.2.2.1.3.40.7 = STRING: "highest number of connections in use at any one time since system startup" iso.3.6.1.4.1.9.9.147.1.2.2.2.1.4.40.6 = Counter32: 0 iso.3.6.1.4.1.9.9.147.1.2.2.2.1.4.40.7 = Counter32: 0 iso.3.6.1.4.1.9.9.147.1.2.2.2.1.5.40.6 = Gauge32: 209 <--- 現在のコネクション数 iso.3.6.1.4.1.9.9.147.1.2.2.2.1.5.40.7 = Gauge32: 9722 <--- ピーク時のコネクション数
以下はコネクション数の確認用の各OIDとオブジェクト名です。
ASA5555# show snmp-server oidlist | in ConnectionStat [372] 1.3.6.1.4.1.9.9.147.1.2.2.2.1.3. cfwConnectionStatDescription [373] 1.3.6.1.4.1.9.9.147.1.2.2.2.1.4. cfwConnectionStatCount [374] 1.3.6.1.4.1.9.9.147.1.2.2.2.1.5. cfwConnectionStatValue
show perfmon コマンドで確認可能です。Current値が現在の生成レート、Average値が起動後からの平均レートとなります。
例えば以下は 毎秒 900程度のTCPコネクションを発生時の出力例となりますが、全体のコネクション(TCP/UDP/ICMP含む)が秒間 1100程度、TCPコネクションが毎秒900程度、UDPコネクションが200程度であることを確認できます。
ASA5555(config)# show perfmon PERFMON STATS: Current Average Xlates 175/s 3/s Connections 1136/s 21/s <--- THIS TCP Conns 928/s 11/s <--- THIS UDP Conns 208/s 8/s <--- THIS URL Access 0/s 0/s URL Server Req 0/s 0/s TCP Fixup 0/s 0/s TCP Intercept Established Conns 0/s 0/s TCP Intercept Attempts 0/s 0/s TCP Embryonic Conns Timeout 3/s 7/s FTP Fixup 0/s 0/s AAA Authen 0/s 0/s AAA Author 0/s 0/s AAA Account 0/s 0/s HTTP Fixup 0/s 0/s VALID CONNS RATE in TCP INTERCEPT: Current Average N/A 66.89%
ASAバージョン 9.9以降を利用時、count オプションを利用し、指定のRegexにマッチした行数のカウントをできます。
ASA5555(config)# show conn | ? append Append to file begin Begin with the line that matches count Count number of lines which match regexp <--- THIS exclude Exclude lines that match grep Include/exclude lines that match include Include lines that match redirect Redirect to file
以下は show conn コマンドの実行例となりますが、利用しているプロトコルは先頭に表示されます。
ASA5555(config)# show conn UDP outside02 xx.xx.xx.222:53 inside 1.160.0.115:34982, idle 0:01:30, bytes 172, flags X UDP outside02 xx.xx.xx.222:53 inside 1.160.0.115:38619, idle 0:01:38, bytes 172, flags X UDP outside02 xx.xx.xx.222:53 inside 1.160.0.115:50761, idle 0:01:46, bytes 172, flags X ICMP outside xx.xx.1.1:0 inside 1.150.0.39:57722, idle 0:00:00, bytes 56, flags X
例えば、TCPのコネクション数を数える場合、"show conn | count TCP"コマンドを利用できます。以下出力例の場合、TCPコネクションが 76個あることを確認できます。
ASA5555(config)# show conn | count TCP Number of lines which match regexp = 76
例えば、UDPのコネクション数を数える場合、"show conn | count UDP"コマンドを利用できます。以下出力例の場合、UDPコネクションが 65676個あることを確認できます。
ASA5555(config)# show conn | count UDP Number of lines which match regexp = 65676
例えば、ICMPのコネクション数を数える場合、"show conn | count ICMP"コマンドを利用できます。以下出力例の場合、ICMPコネクションが 1個あることを確認できます。
ASA5555(config)# show conn | count ICMP Number of lines which match regexp = 1
show local-host コマンドの利用が便利です。活用例について詳しくは以下ドキュメントを確認してください。なお、all オプションを付けない場合、ASAを経由する通信のみの出力となることに注意してください。
https://community.cisco.com/t5/-/-/ta-p/3156058
例えば以下例の場合、6個のASAの管理IPアドレス宛 (=NP Identity Ifc 1.150.0.169:22) の通信が発生している事が分かります。
ASAv10# show conn all 7 in use, 92 most used TCP dmz xx.xx.xx.38:443 NP Identity Ifc 1.150.0.169:18303, idle 0:00:02, bytes 5275, flags UO TCP outside 100.0.0.1:51145 NP Identity Ifc 100.0.0.254:443, idle 0:00:01, bytes 30765995, flags UOB TCP dmz 10.xx.xx.4:23203 NP Identity Ifc 1.150.0.169:22, idle 0:00:12, bytes 3475, flags UOB TCP dmz 10.xx.xx.4:23200 NP Identity Ifc 1.150.0.169:22, idle 0:00:33, bytes 2771, flags UOB TCP dmz 10.xx.xx.4:23197 NP Identity Ifc 1.150.0.169:22, idle 0:00:41, bytes 2899, flags UOB TCP dmz 10.xx.xx.4:23196 NP Identity Ifc 1.150.0.169:22, idle 0:00:50, bytes 2771, flags UOB TCP dmz 10.xx.xx.4:23191 NP Identity Ifc 1.150.0.169:22, idle 0:00:00, bytes 13555, flags UOB ASAv10#
"show local-host all brief connection [tcp|udp|embryonic] <connection数>"コマンドを実行することで、指定タイプの 指定コネクション"以上"を利用しているIPアドレスの確認が可能です。例えば、5個以上のTCPコネクションを貼っているホストを確認したい場合は、 "show local-host all brief connection tcp 5"コマンドを実行します。以下例の場合、Interface DMZの先にいる 10.xx.xx.4 が 5つのTCPコネクションを持っていることが確認できます。なお、1.150.0.169はASAの管理IPアドレスです。
ASAv10# show local-host all brief connection tcp 5 Interface management: 0 active, 0 maximum active, 0 denied Interface dmz: 1 active, 54 maximum active, 0 denied local host: <10.xx.xx.4>, SCTP flow count/limit = 0/unlimited TCP flow count/limit = 5/unlimited <--- THIS TCP embryonic count to host = 0 TCP intercept watermark = unlimited UDP flow count/limit = 0/unlimited Interface outside: 2 active, 8 maximum active, 0 denied Interface any: 0 active, 0 maximum active, 0 denied Interface identity: 2 active, 3 maximum active, 0 denied local host: <1.150.0.169>, SCTP flow count/limit = 0/unlimited TCP flow count/limit = 5/unlimited TCP embryonic count to host = 0 TCP intercept watermark = unlimited UDP flow count/limit = 0/unlimited
指定ホストのコネクションを確認したい場合、"show local-host <IPアドレス> all"コマンドを実行します。より詳細なコネクション情報を確認したい場合は、detailオプションをつけてください。
ASAv10# show local-host 10.70.233.4 all Interface management: 0 active, 0 maximum active, 0 denied Interface dmz: 1 active, 54 maximum active, 0 denied local host: <10.70.233.4>, SCTP flow count/limit = 0/unlimited TCP flow count/limit = 5/unlimited TCP embryonic count to host = 0 TCP intercept watermark = unlimited UDP flow count/limit = 0/unlimited Conn: TCP dmz 10.70.233.4:23203 NP Identity Ifc 1.150.0.169:22, idle 0:00:00, bytes 16211, flags UOB TCP dmz 10.70.233.4:23200 NP Identity Ifc 1.150.0.169:22, idle 0:00:53, bytes 2771, flags UOB TCP dmz 10.70.233.4:23197 NP Identity Ifc 1.150.0.169:22, idle 0:01:00, bytes 2899, flags UOB TCP dmz 10.70.233.4:23196 NP Identity Ifc 1.150.0.169:22, idle 0:00:09, bytes 2771, flags UOB TCP dmz 10.70.233.4:23191 NP Identity Ifc 1.150.0.169:22, idle 0:00:39, bytes 39363, flags UOB Interface outside: 2 active, 8 maximum active, 0 denied Interface any: 0 active, 0 maximum active, 0 denied Interface identity: 2 active, 3 maximum active, 0 denied ASAv10# ASAv10# show local-host 10.70.233.4 all detail Interface management: 0 active, 0 maximum active, 0 denied Interface dmz: 1 active, 54 maximum active, 0 denied local host: <10.70.233.4>, SCTP flow count/limit = 0/unlimited TCP flow count/limit = 5/unlimited TCP embryonic count to host = 0 TCP intercept watermark = unlimited UDP flow count/limit = 0/unlimited Conn: TCP dmz: 10.70.233.4/23203 NP Identity Ifc: 1.150.0.169/22, flags UOB , idle 0s, uptime 32m8s, timeout 1h0m, bytes 19059 TCP dmz: 10.70.233.4/23200 NP Identity Ifc: 1.150.0.169/22, flags UOB , idle 55s, uptime 32m30s, timeout 1h0m, bytes 2771 TCP dmz: 10.70.233.4/23197 NP Identity Ifc: 1.150.0.169/22, flags UOB , idle 1s, uptime 32m39s, timeout 1h0m, bytes 2899 TCP dmz: 10.70.233.4/23196 NP Identity Ifc: 1.150.0.169/22, flags UOB , idle 11s, uptime 32m46s, timeout 1h0m, bytes 2771 TCP dmz: 10.70.233.4/23191 NP Identity Ifc: 1.150.0.169/22, flags UOB , idle 41s, uptime 33m48s, timeout 1h0m, bytes 39363 Interface outside: 2 active, 8 maximum active, 0 denied Interface any: 0 active, 0 maximum active, 0 denied Interface identity: 2 active, 3 maximum active, 0 denied
show conn countコマンドで、約8万という膨大なコネクションが発生している事を確認できます。
ASA5555(config)# show conn count 85938 in use, 85938 most used
show perfmon コマンドから、毎秒6,000程度の膨大なUDPコネクションが発生してる事を確認できます。
ASA5555(config)# show perfmon PERFMON STATS: Current Average Xlates 3/s 3/s Connections 6021/s 21/s TCP Conns 1/s 11/s UDP Conns 6017/s 8/s <--- URL Access 0/s 0/s URL Server Req 0/s 0/s TCP Fixup 0/s 0/s TCP Intercept Established Conns 0/s 0/s TCP Intercept Attempts 0/s 0/s TCP Embryonic Conns Timeout 0/s 7/s FTP Fixup 0/s 0/s AAA Authen 0/s 0/s AAA Author 0/s 0/s AAA Account 0/s 0/s HTTP Fixup 0/s 0/s VALID CONNS RATE in TCP INTERCEPT: Current Average N/A 66.89%
show conn | count <protocol> コマンドの結果から、コネクションの殆どはUDPであることがわかります。
ASA5555(config)# show conn | count TCP Number of lines which match regexp = 75 ASA5555(config)# show conn | count UDP Number of lines which match regexp = 80543 <--- THIS ASA5555(config)# show conn | count ICMP Number of lines which match regexp = 0
"show local-host all brief connection udp 100"コマンドで、100以上のコネクションを発生しているホストのIPアドレスを確認します。1.150.0.39と 10.xx.xx.245が 65,000ほどのUDPコネクションを持っている事を確認できます。全体のコネクションの8割くらいを、1.150.0.39と 10.xx.xx.245 が占有していることがわかり、明らかに異常です。(本例の場合、1.150.0.39と 10.xx.xx.245間で膨大なUDPコネクションが発生しているため、2つのホストのIPアドレスが出力されています。10.xx.xx.245は Outside側のホストのため、外部から何らかの膨大なUDPのコネクションが発生してると推測できます。)
ASA5555(config)# show local-host all brief connection udp 100 Interface manage: 0 active, 0 maximum active, 0 denied Interface test: 0 active, 0 maximum active, 0 denied Interface outside02: 83 active, 173 maximum active, 0 denied Interface inside: 169 active, 538 maximum active, 0 denied local host: <1.150.0.39>, SCTP flow count/limit = 0/unlimited TCP flow count/limit = 0/unlimited TCP embryonic count to host = 0 TCP intercept watermark = unlimited UDP flow count/limit = 65536/unlimited Interface outside: 158 active, 366 maximum active, 0 denied local host: <10.xx.xx.245>, <--- THIS SCTP flow count/limit = 0/unlimited TCP flow count/limit = 0/unlimited TCP embryonic count to host = 0 TCP intercept watermark = unlimited UDP flow count/limit = 65536/unlimited <--- THIS Interface nlp_int_tap: 0 active, 2 maximum active, 0 denied Interface any: 0 active, 0 maximum active, 0 denied Interface identity: 2 active, 3 maximum active, 0 denied
"clear conn addree <IPアドレス>"コマンドで、指定のIPアドレスのコネクションを全てクリアできます。以下は、outside側の10.xx.xx.245のコネクションを全て切断と、その後のコネクション数の確認例です。コネクションクリア後に、全体のコネクション数が 5000ほどに下がったことを確認できます。
ASA5555(config)# clear conn address 10.xx.xx.245 65536 connection(s) deleted. ASA5555(config)# show conn count 5675 in use, 98756 most used
なお、コネクションをクリアしても、一時的な対処にしかなりません。コネクションの膨大な利用や 攻撃が続き、そのIPアドレスからの通信を遮断したい場合は、そのIPアドレスからのアクセスを、ASAのアクセスリストや、もしくは ASAの手前の機器(ルータ・スイッチなど)のアクセスリストなどで遮断を検討してください。
ASA: show local-host コマンドの活用例
https://community.cisco.com/t5/-/-/ta-p/3156058
ASA: トラフィック量の多いコネクションやIPアドレスの確認方
https://community.cisco.com/t5/-/-/ta-p/3198717
ファイアウォール トラブルシューティング
https://supportforums.cisco.com/ja/document/12725841
Firepower System and FTDトラブルシューティング
https://community.cisco.com/t5/-/-/ta-p/3161733
Taisuke さん、こんにちは!
こちらの情報は非常に参考になり、最近 show perfmon コマンドは活用するようになっています。
1点、該当のコマンド (show perfmon) について教えてほしいのですが
Current は直近1秒以内での count 数になると理解しているのですが、
Average については どの程度の期間に対しての平均値(例えば、直近60秒での1秒あたりの平均値など...)なのでしょうか。
コマンドリファレンスや、以下のサイトにも特に記載がないため情報があれば教えて頂ければ嬉しいです。
お忙しい中申し訳ございませんが、よろしくお願い致します。
Mayuponさん、こんばんは!
以下のEnhancementに記載がありますが、Averageは (なんと) ASA起動時からの累積平均となるため、24時間365日の運用時の平均利用状況を把握するのには便利です。(なお、以下のEnhancementに記載の通り、Averageを "累積"から "5分程度"にする案も弊社内では出たのですが、私の知る限りは 採用予定は未定です。将来はわかりませんが。。)
https://bst.cloudapps.cisco.com/bugsearch/bug/CSCsu52841
逆に、例えば DDoS発生時の通信量確認や、特定の期間(朝方や夕方など)の瞬間的な通信量を把握したい場合などは、Current値 を用いることになるかと思います。
なお、Currentと Averageを比較することで、今の Current がどのくらい平均から離れてるのか、突出してるのか、把握するのに便利かと思います。
ご参考になれば幸いです。
Taisuke さん、こんにちは!
詳細なご回答ありがとうございました。
Average はまさかの起動時からの平均値なのですね...勉強になりました...!!
平均セッション数を確認する際、何に対して比較したいのかという用途に応じて Current か Average を参考にしようと思います。
検索バーにキーワード、フレーズ、または質問を入力し、お探しのものを見つけましょう
シスコ コミュニティをいち早く使いこなしていただけるよう役立つリンクをまとめました。みなさんのジャーニーがより良いものとなるようお手伝いします
下記より関連するコンテンツにアクセスできます