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

== 目次 ==

1. Introduction

2. 基本
   2.1. 基本コマンド
   2.2. 確認コマンド
   2.3. 使用例

3. 便利な使い方
    
3.1 リダイレクト
    3.2 フィルタリング
 

 

1. Introduction

本ドキュメントではIOSでもお馴染みのDebugコマンドの、NX-OS上での使用方法に関して紹介します。

ただし、Debugコマンドは機器に思わぬ負荷を掛ける場合があるため、実施される際はCisco TAC engineer等の指示に則って実施頂くことを推奨します。

2. 基本

2.1. 基本コマンド

基本的な使用方法はIOSと同様で、下記例の様に実施します。

使用可能な機能・オプションはNX-OSのversionやProduct(Nexus7000やNexus5000)によって異なるため、その都度 "?" オプションにて確認します。

N7K# debug <Option>
N7K# debug ?
aaa             Enable debugging for aaa
acllog          Configure acllog debug
aclmgr          Configure aclmgr debug
......          ........

N5K# debug ?
aaa             Enable debugging for aaa
aclmgr          Configure aclmgr debug
afm             Configure afm debug
......          ........

例)
N7K# debug ip arp packet

 

実施中のDebugの解除 :

N7K# undebug all                    # 全解除

N7K# undebug ip arp packet          # 特定オプションのみ解除
N7K# no debug ip arp packet         # 特定オプションのみ解除

2.2. 確認コマンド

現在実施中の全Debugの確認 :

N7K# show debug
Debug level is set to Minor(1)
default for new sessions logging level: 3
debug ip arp event
debug ip arp packet
debug ip icmp

 

 

特定機能に限った実施中Debugの確認 :

N7K# show debug arp
debug ip arp event
debug ip arp packet

2.3. 使用例

上記例の`debug ip arp packet`を実際に使用すると下記のようになります。(結果青字表示)

`clear ip arp`によってARP tableがリフレッシュされる為、Re-Arpが行われ、100.0.0.1 -> 100.0.0.2 宛にARP Requestが送信され(結果上二行)、100.0.0.2 -> 100.0.0.1宛にARP Replyが返ってきている様子(結果下二行)がわかります。

N7K# show ip interface brief | grep up
Vlan100              100.0.0.1       protocol-up/link-up/admin-up

N7K# show ip arp | begin Address
Address         Age       MAC Address     Interface
100.0.0.2       00:00:24  001b.54c2.b442  Vlan100

N7K# debug ip arp packet
N7K# show debug arp
debug ip arp packet

N7K#
N7K# clear ip arp
09:16:46 arp: (context 1) Sending packet on Vlan100, logical interface Vlan100 physical interface Ethernet8/1, (prty 0) Hrd type 1 Prot type 800 Hrd len 6 Prot len 4 OP 1,  Pkt size 28
09:16:46 arp: Src 001b.54c2.b443/100.0.0.1 Dst 001b.54c2.b442/100.0.0.2
09:16:46 arp: (context 1) Receiving packet from Vlan100, logical interface Vlan100 physical interface Ethernet8/1, (prty 6) Hrd type 1 Prot type 800 Hrd len 6 Prot len 4 OP 2,  Pkt size 46
09:16:46 arp: Src 001b.54c2.b442/100.0.0.2 Dst 001b.54c2.b443/100.0.0.1
N7K#

N7K# undebug all

※見やすさの為にTimeStampは一部省略しています。実際は "2013 Nov 13 09:16:46.045911" といった形式となります。

 

3. 便利な使い方

3.1 リダイレクト

下記コマンドにてDebug結果をコンソールやモニターセッションに出力する代わりに指定ファイルへ直接書き込むことが可能です。

本コマンドによってDebug作業中のCPU処理のオーバーヘッドを抑制することができ、運用への影響を抑えることが可能です。

作成されたファイルはNX-OS上で直接確認することはもちろん、外部へコピーした後にゆっくり確認することも可能です。

 

N7K# debug logfile <FILE名>
N7K# debug logfile MyDebugTest.log
N7K# dir log:
          0    Nov 13 09:29:34 2013  MyDebugTest.log      # 指定ファイルは log: 配下に作成されます
      14080    Nov 13 00:23:32 2013  messages
       3482    Nov 13 09:16:46 2013  startupdebug
          0    Nov 13 09:28:23 2013  test
 
Usage for log://sup-local
     622592 bytes used
   51806208 bytes free
   52428800 bytes total
 
N7K#
N7K# show debug
Output forwarded to file MyDebugTest.log (size: 4194304 bytes)
Debug level is set to Minor(1)
default for new sessions logging level: 3
 
debug ip arp packet
 
N7K# clear ip arp
N7K#                                                      # 直接ここに出力はしません
N7K# dir log:
        598    Nov 13 09:29:34 2013  MyDebugTest.log       # 代わりに指定ファイルの容量が増えています
      14080    Nov 13 00:23:32 2013  messages
       3482    Nov 13 09:16:46 2013  startupdebug
          0    Nov 13 09:28:23 2013  test
 
Usage for log://sup-local
     626688 bytes used
   51802112 bytes free
   52428800 bytes total
 
N7K# show debug logfile MyDebugTest.log                   # 指定ファイルの中身を確認
09:29:33 arp: (context 1) Sending packet on Vlan100, logical interface Vlan100 physical interface Ethernet8/1, (prty 0) Hrd type 1 Prot type 800 Hrd len 6 Prot len 4 OP 1,  Pkt size 28
09:29:33 arp: Src 001b.54c2.b443/100.0.0.1 Dst 001b.54c2.b442/100.0.0.2
09:29:33 arp: (context 1) Receiving packet from Vlan100, logical interface Vlan100 physical interface Ethernet8/1, (prty 6) Hrd type 1 Prot type 800 Hrd len 6 Prot len 4 OP 2,  Pkt size 46
09:29:33 arp: Src 001b.54c2.b442/100.0.0.2 Dst 001b.54c2.b443/100.0.0.1
N7K#
N7K# copy log:MyDebugTest.log ftp://<IP>/<Folder> vrf management    # FTP serverへ抽出
Enter username: anonymous
Password:
***** Transfer of file Completed Successfully *****
Copy complete, now saving to disk (please wait)...
N7K#
N7K# delete log:MyDebugTest.log                                     # ファイルの消去
Do you want to delete "/MyDebugTest.log" ? (yes/no/abort)   [y] y
N7K#
N7K# undebug all

 

 

リダイレクトファイルのサイズ指定:

N7K# debug logfile <FILE名> size <4096-4194304> (bytes)

 

3.2 フィルタリング

下記コマンドにて、Debugを掛ける対象を特定のFlowのみ等、制限することが可能です。

こちらにより用事の無いFlowに対して無駄にCPU処理を割く必要がなくなり、また余計な結果が省かれることで解析の効率も上がります。

N7K# debug-filter <option>
 
N7K# debug-filter ip arp ?                   # ARPは関連IPか関連I/Fでフィルター可能
  address    IP address filter
  interface  Interface filter
 
N7K# debug-filter ip icmp packet ?           # ICMPはもう少し詳細にフィルター可能
  address    IP address filter for source or destination
  dest       IP destination filter
  direction  IP packet direction
  interface  Interface filter
  source     IP source filter
  vrf        Display per-VRF information
 
 
###  使用例  ###
N7K# debug ip arp packet
N7K# debug-filter ip arp address 100.0.0.2   #`debug ip arp <option>`を100.0.0.2関連のみに限定
N7K#
N7K# show debug
Debug level is set to Minor(1)
default for new sessions logging level: 3
debug ip arp packet

N7K#
N7K# show debug-filter all
debug-filter ip arp address 100.0.0.2
N7K#
N7K# clear ip arp                           # 100.0.0.2関連にDebugが掛かっていることを確認
01:32:16 arp: (context 1) Sending packet on Vlan100, logical interface Vlan100 physical interface Ethernet8/1, (prty 0) Hrd type 1 Prot type 800 Hrd len 6 Prot len 4 OP 1,  Pkt size 28
01:32:16 arp: Src 001b.54c2.b443/100.0.0.1 Dst 001b.54c2.b442/100.0.0.2
01:32:16 arp: (context 1) Receiving packet from Vlan100, logical interface Vlan100 physical interface Ethernet8/1, (prty 6) Hrd type 1 Prot type 800 Hrd len 6 Prot len 4 OP 2,  Pkt size 46
01:32:16 arp: Src 001b.54c2.b442/100.0.0.2 Dst 001b.54c2.b443/100.0.0.1
N7K#
N7K#
N7K# debug-filter ip arp address 100.0.0.100  # フィルターを100.0.0.100に変更
N7K# show debug-filter all
debug-filter ip arp address 100.0.0.100
N7K#
N7K# clear ip arp
N7K#                                         # 100.0.0.2関連にdebugが実施されなくなる
N7K#
N7K# undebug all
N7K# no debug-filter all                      # 解除
no debug-filter ip arp address 100.0.0.100

 

 

4. 関連コンテンツ

Nexus スイッチ (NX-OS) : 設定例

 

(作成日:2013年11月13日)

(修正日:2019年01月24日)

Getting Started

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

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