キャンセル
次の結果を表示 
次の代わりに検索 
もしかして: 
cancel
3712
閲覧回数
0
いいね!
0
コメント
Taisuke Nakamura
Cisco Employee
Cisco Employee

 

  

  

show コマンド出力のフィルタリング

ASAのコマンドラインは、| (パイプ/バーティカルバー)を利用しての、アウトプットのフィルタリングに対応します。 オプションは include、exclude、beginなどから選択可能です。 また正規表現を さらに |で区切る事で、複数条件を同時指定できます。

コマンド構文

hostname# show command | {include | exclude | begin} regexp

   
コマンド確認例

ASA5555(config)# sh run | ?

    append    Append to file
    begin       Begin with the line that matches
    exclude    Exclude lines that match
    grep         Include/exclude lines that match
    include     Include lines that match
    redirect    Redirect to file

ASA5555(config)# sh run | include ?

    LINE    Regular Expression
 include   正規表現に一致する 全ての出力行を表示
 exclude   正規表現に一致する 全ての出力行が除外
 begin   正規表現に一致する行から出力を開始

    

本ドキュメントでは、当 | (パイプ/バーティカルバー)を利用した、便利なトラブルシューティング用コマンド例について紹介します。 

   

   

コマンド活用例

バージョンとハードウェアとシリアル(ライセンス発行用)の一括確認

ASA5555(config)# sh ver | in Ver|Hard|Seri
Cisco Adaptive Security Appliance Software Version 9.4(2)
Device Manager Version 7.5(2)
Hardware: ASA5555, 16384 MB RAM, CPU Lynnfield 2792 MHz, 1 CPU (8 cores)
Baseboard Management Controller (revision 0x1) Firmware Version: 2.1
Serial Number: FCH1536****

なお、show versionで確認できるシリアルは ライセンス発行に用います。 RMAで利用するハードウェア シリアルは show inventoryコマンドで確認できます。

      

各インターフェイスのnameifとIPアドレスの一括確認

ASA5555(config)# sh run | in int|ip addr|name
hostname ASA5555
domain-name cisco.com
names
interface GigabitEthernet0/0
nameif outside
ip address 10.71.xx.xx 255.255.255.0
interface GigabitEthernet0/1
nameif inside
ip address 1.0.xx.xx 255.0.0.0
interface GigabitEthernet0/2
nameif outside02
ip address 10.71.xx.xx 255.255.255.0
interface GigabitEthernet0/3
no nameif
no ip address
interface GigabitEthernet0/4
no nameif
no ip address
interface GigabitEthernet0/5
no nameif
no ip address
interface GigabitEthernet0/6
no nameif
no ip address
interface GigabitEthernet0/7
no nameif
no ip address
interface Management0/0
nameif manage
no ip address

        

各インターフェイスのnameifとリンクアップ状況、IPアドレス一覧

ASA5555# show interface | in Interface|(IP address)
Interface GigabitEthernet0/0 "outside", is up, line protocol is up
IP address xx.xx.xx.xx, subnet mask 255.255.255.0
Interface GigabitEthernet0/1 "inside", is up, line protocol is up
IP address xx.xx.xx.xx, subnet mask 255.0.0.0
Interface GigabitEthernet0/2 "outside02", is up, line protocol is up
IP address xx.xx.xx.xx, subnet mask 255.255.255.0
Interface GigabitEthernet0/3 "test", is administratively down, line protocol is down
IP address 99.99.99.99, subnet mask 255.255.255.0

   

各インターフェイスの総パケット数とエラードロップ数の一括確認

ASA5555(config)# sh int | in Int|packets|errors|collision
Interface GigabitEthernet0/0 "outside", is up, line protocol is up
        585285830 packets input, 411278711678 bytes, 0 no buffer
        0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
        553925423 packets output, 414640848759 bytes, 0 underruns
        0 output errors, 0 collisions, 2 interface resets
        0 late collisions, 0 deferred
        585285757 packets input, 400326464827 bytes
        553925428 packets output, 404162870017 bytes
        896659 packets dropped
Interface GigabitEthernet0/1 "inside", is up, line protocol is up
        640752760 packets input, 427186999665 bytes, 0 no buffer
        0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
        699350312 packets output, 541840515141 bytes, 0 underruns
        0 output errors, 0 collisions, 1 interface resets
        0 late collisions, 0 deferred
        640751682 packets input, 415061850026 bytes
        699350312 packets output, 528647242249 bytes
        21030935 packets dropped
Interface GigabitEthernet0/2 "outside02", is up, line protocol is up
        101334460 packets input, 130148157783 bytes, 0 no buffer
        0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
        39135013 packets output, 8915591979 bytes, 0 underruns
        0 output errors, 0 collisions, 1 interface resets
        0 late collisions, 0 deferred
        101334458 packets input, 128303444861 bytes
        39135013 packets output, 8125012886 bytes
        367862 packets dropped

   

ロギングバッファ出力のフィルタリング

ASAのサポートする シスログレベルは以下の8段階があります。 

ASA5520/pri/act(config)# logging buffered ?

configure mode commands/options:
   <0-7> Enter syslog level (0 - 7)
   WORD Specify the name of logging list
   alerts Immediate action needed (severity=1)
   critical Critical conditions (severity=2)
   debugging Debugging messages (severity=7)
   emergencies System is unusable (severity=0)
   errors Error conditions (severity=3)
   informational Informational messages (severity=6)
   notifications Normal but significant conditions (severity=5)
   warnings Warning conditions (severity=4)

    
各ロギングメッセージには、ASA-[level]-[message ID] が付与されるため、シスログレベルを指定しフィルタする事で、show logの確認がより簡便になります。

例えば、以下は、Severity=1(Alerts)と Severity=2(Critical)のみを表示するためのコマンドです。 Failover発生や インターフェイスDown/Upなど、機器動作における重要なイベントを一括確認できます。

ASA5520/pri/act# sh log | in ASA-1|ASA-2
Jun 23 2016 11:26:44: %ASA-1-105002: (ASA) Enabling failover.
Jun 23 2016 11:26:48: %ASA-1-709006: (Primary) End Configuration Replication (STB)
Jun 23 2016 11:27:05: %ASA-1-105003: (Primary) Monitoring on interface Server-Zone waiting
Jun 23 2016 11:27:05: %ASA-1-105003: (Primary) Monitoring on interface WEB-Zone waiting
Jun 23 2016 11:27:05: %ASA-1-105003: (Primary) Monitoring on interface Outside waiting
Jun 23 2016 11:27:05: %ASA-1-105007: (Primary) Link status 'Down' on interface Server-Zone
Jun 23 2016 11:27:05: %ASA-1-105006: (Primary) Link status 'Up' on interface WEB-Zone
Jun 23 2016 11:27:05: %ASA-1-105006: (Primary) Link status 'Up' on interface Outside
Jun 23 2016 11:27:13: %ASA-1-105004: (Primary) Monitoring on interface WEB-Zone normal
Jun 23 2016 11:27:13: %ASA-1-105004: (Primary) Monitoring on interface Outside normal
Jun 23 2016 11:52:26: %ASA-1-104001: (Primary) Switching to ACTIVE - Set by the config command.
Jun 23 2016 12:58:22: %ASA-1-104002: (Primary) Switching to STANDBY - Set by the config command
Jun 23 2016 12:58:24: %ASA-1-104001: (Primary) Switching to ACTIVE - Set by the config command.

    
以下は、Severity=5(Notification)のみを表示するためのコマンド例です。 機器操作ログは通常、Notificationレベルで出力されますので、直近で どのような操作があったか抜粋し確認できます。

ASA5520/pri/act# sh log | in ASA-5
Jun 23 2016 12:58:08: %ASA-5-111008: User 'enable_15' executed the 'logging buffered info' command.
Jun 23 2016 12:58:08: %ASA-5-111010: User 'enable_15', running 'CLI' from IP 0.0.0.0, executed 'logging buffered info'
Jun 23 2016 12:58:11: %ASA-5-111005: console end configuration: OK
Jun 23 2016 12:58:16: %ASA-5-111001: Begin configuration: console writing to memory
Jun 23 2016 12:58:22: %ASA-5-111004: console end configuration: OK
Jun 23 2016 12:58:22: %ASA-5-111008: User 'enable_15' executed the 'write' command.
Jun 23 2016 12:58:22: %ASA-5-111010: User 'enable_15', running 'CLI' from IP 0.0.0.0, executed 'write'
Jun 23 2016 12:58:22: %ASA-5-111008: User 'enable_15' executed the 'no failover active' command.
Jun 23 2016 12:58:22: %ASA-5-111010: User 'enable_15', running 'CLI' from IP 0.0.0.0, executed 'no failover active'
Jun 23 2016 12:58:24: %ASA-5-111008: User 'enable_15' executed the 'failover active' command.
Jun 23 2016 12:58:24: %ASA-5-111010: User 'enable_15', running 'CLI' from IP 0.0.0.0, executed 'failover active'

   

   

  

ベストプラクティス

指定IPアドレスのフィルタリングを行いたい場合

各オクテットの区切り文字である「. (ドット)」が正規表現として処理されてしまうのを避けるため、. の前に \を付ける必要があります。

以下は、指定IPアドレス「1.0.0.2」のフィルタリング 出力例です。

ASA(config)# show log | in 1\.0\.0\.2
Jun 20 2017 14:05:45: %ASA-7-710005: UDP request discarded from 1.0.0.2/67 to inside:255.255.255.255/68
Jun 20 2017 14:05:45: %ASA-7-710005: UDP request discarded from 1.0.0.2/67 to manage:255.255.255.255/68
Jun 20 2017 14:05:50: %ASA-6-302016: Teardown UDP connection 7571927 for outside:171.68.xx.xx/123 to inside:1.0.0.2/123 duration 0:10:50 bytes 1056

  

  

  

参考情報

ASA9.4: Using the Command-Line Interface (英語)
http://www.cisco.com/c/en/us/td/docs/security/asa/asa94/config-guides/cli/general/asa-94-general-config/ref-cli.html

ASA9.1: コマンドライン インターフェイスの使用 (日本語)
http://www.cisco.com/cisco/web/support/JP/docs/SEC/Firewall/ASA5500NextGenerationFire/CG/001/ref_cli.html?bid=0900e4b183271d68

ファイアウォール トラブルシューティング
https://community.cisco.com/t5/-/-/ta-p/3157007

Firepower System and FTDトラブルシューティング
https://community.cisco.com/t5/-/-/ta-p/3161733

 

Getting Started

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

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