ルーターおよびルーターの論理システムのスイッチ
論理システムでは、ルーターとスイッチの動作モード コマンドを監視できます。詳細については、以下のトピックを参照してください。
例:論理システムでの動作モード コマンドの実行
この例では、CLI を指定された論理システム ビューに設定し、論理システムに対して動作モード コマンドを実行してから、メイン ルーター ビューに戻る方法を示しています。
要件
論理システムに 対する表示 権限が必要です。
概要
一部の動作モード コマンドについては、 論理 システム オプションを含め、コマンドの出力を絞り込むか、コマンドの操作を指定された論理システムに制限できます。たとえば、 show route
コマンドには論理システム オプション があります。LS3 と呼ばれる論理システムでこのコマンドを実行するには、 show route logical-system LS3
を使用します。ただし、 などの一部のコマンド show interfaces
には、論理 システム オプションはありません 。このようなコマンドについては、別のアプローチが必要です。
特定の論理システムのコンテキストに自分を配置できます。論理システム コンテキストを設定するには、 コマンドを実行 set cli logical-system logical-system-name
します。
CLI システム コンテキスト モードで、動作モード コマンドを入力すると、コマンドの出力には論理システムに関連する情報のみ表示されます。
構成
手順
手順
次の例では、設定階層内のさまざまなレベルに移動する必要があります。デバイスのナビゲーションの詳細については、「 CLI ガイド 」の「 設定モードでの CLI CLI エディター の使用 」を 参照してください。
CLIの論理システム コンテキストに設定するには、次の方法に示します。
メイン ルーターから論理システムを設定します。
[edit] user@host# set logical-systems LS3
デバイスの設定が完了したら、設定をコミットします。
[edit] user@host# commit user@host# exit
論理システムをCLIするインターフェイスを設定します。
user@host> set cli logical-system LS3 Logical system: LS3 user@host:LS3>
動作モード コマンドを実行します。
user@host:LS3> show interfaces terse Interface Admin Link Proto Local Remote lt-1/2/0 lt-1/2/0.3 up up inet 10.0.2.1/30
論理システム設定を編集するには、設定モードにします。
user@host:LS3> edit Entering configuration mode user@host:LS3#
設定モードを終了して動作モードに戻ります。
user@host:LS3# exit Exiting configuration mode
論理システム ビューを消去して、メイン ルーター のビューに戻します。
user@host:LS3> clear cli logical-system Cleared default logical system user@host>
XML プロトコル クライアント アプリケーションを使用する場合Junos同じ効果を達成するには、<set-logical-systemプロトコル タグを>します。
<rpc> <set-logical-system> <logical-system>LS1</logical-system> </set-logical-system> </rpc>
論理システム ロギングの概要
このJunos OSシステム ログ メッセージ(とも呼ばれる)を生成し、デバイスで発生した syslog messages システム イベントを記録します。
各システム ログ メッセージは、メッセージJunos OSを識別し、発生した操作またはエラーを簡単に記述します。このリファレンスでは、各システム ログ メッセージに関するより詳細な情報を提供します。該当する場合は、メッセージの考えられる原因と、エラーの状態を修正するために実行できるアクションについて説明します。
論理システムが作成されると、として知られているシステム ログ メッセージ syslog が階層レベルで [edit system]
設定されます。syslog は、デフォルトの論理システムと同じファイルを、syslog メッセージの先頭に論理システムの名前を付いて書き込まれます。
各論理システムは、/var/logical-systems/ ディレクトリに作成された logical-system-name ディレクトリ構造を持っています。論理システムの下で traceoptions が設定されている場合、システム ログ メッセージは/var/logical-systems/ ディレクトリに保存 logical-system-name されます。
syslog は logical-system-name /var/logical-systems/ディレクトリに渡されませんが、traceoptions は/var/logical-systems/ ディレクトリに渡 logical-system-name されます。
例: 論理システムBGPのトレース ファイルの表示
この例では、論理システムに保存されているファイルを一覧表示および表示する方法を示しています。
要件
論理システムに 対する表示 権限が必要です。
例: 論理システム上の内部ネットワーク BGP BGP ピアリング セッションの設定 に示すネットワークなどのネットワークを 設定します。
概要
論理システムは、/var/logical-systems/ ディレクトリに個々のディレクトリ logical-system-name 構造を作成します。以下の要素が含まれます。
/config— 論理システムに固有のアクティブな設定が含されます。
/log— 論理システムに固有のシステム ログおよびトレース ファイルが含まれます。
以前のバージョンの Junos OS とのログ ファイルの下位互換性を維持するために、論理システムの設定時に、/var/logs/ ディレクトリ logical-system-name から /var/logical-systems/ logical-system-name ディレクトリへの電子メール リンク(symlink)が作成されます。
/tmp— 論理システムに固有の一時ファイルが含されます。
各論理システムのファイル システムを使用すると、論理システム ユーザーはトレース ログを表示し、論理システム ファイルを変更できます。論理システム管理者は、論理システムに固有のすべてのファイルを表示および変更できる完全なアクセス権を持ちます。
論理システム ユーザーと管理者は、保存およびロード設定モード コマンドを使用して、設定ファイルを論理システム レベルで保存してロードできます。さらに、論理システム レベルで、表示ログ、監視、ファイル動作モードコマンドも発行できます。
この例では、論理システム上でBGPトレース ファイルを構成および表示する方法を示しています。この手順を適用して、トレース操作をサポートする任意Junos OS階層レベルのトレース操作に適用できます。
トレース操作をサポートする階層レベルのリストを表示するには、設定モードで helppropos traceoptions コマンドを入力します。
構成
CLI迅速な設定
この例を迅速に設定するには、以下のコマンドをコピーして、テキスト ファイルに貼り付け、改行を削除し、ネットワーク設定に一致する必要がある詳細情報を変更してから、 [edit] 階層レベルでコマンドを CLI にコピー アンド ペーストします。
set logical-systems A protocols bgp group internal-peers traceoptions file bgp-log set logical-systems A protocols bgp group internal-peers traceoptions file size 10k set logical-systems A protocols bgp group internal-peers traceoptions file files 2 set logical-systems A protocols bgp group internal-peers traceoptions flag update detail
トレース操作の設定
手順
次の例では、設定階層内のさまざまなレベルに移動する必要があります。デバイスのナビゲーションについて、詳しくは CLI ガイド の 設定モードでの CLI エディター の使用 CLI を参照してください。
トレース操作を設定するには、次の手順に示します。
論理システム上でトレース操作を設定します。
[edit logical-systems A protocols bgp group internal-peers] user@host# set traceoptions file bgp-log user@host# set traceoptions file size 10k user@host# set traceoptions file files 2 user@host# set traceoptions flag update detail
デバイスの設定が完了したら、設定をコミットします。
[edit] user@host# commit
トレース ファイルの表示
手順
トレース ファイルを表示するには、以下の方法で行います。
メイン ルーターの動作モードで、論理システムのディレクトリを一覧表示します。
user@host> file list /var/logical-systems/A /var/logical-systems/A: config/ log/ tmp/
メイン ルーターの動作モードで、論理システム上のログ ファイルを一覧表示します。
user@host> file list /var/logical-systems/A/log/ /var/logical-systems/A/log: bgp-log
bgpログ ファイル の内容を表示 します。
user@host> file show /var/logical-systems/A/log/bgp-log Aug 10 17:12:01 trace_on: Tracing to "/var/log/A/bgp-log" started Aug 10 17:14:22.826182 bgp_peer_mgmt_clear:5829: NOTIFICATION sent to 192.163.6.4 (Internal AS 17): code 6 (Cease) subcode 4 (Administratively Reset), Reason: Management session cleared BGP neighbor Aug 10 17:14:22.826445 bgp_send: sending 21 bytes to 192.163.6.4 (Internal AS 17) Aug 10 17:14:22.826499 Aug 10 17:14:22.826499 BGP SEND 192.168.6.5+64965 -> 192.163.6.4+179 Aug 10 17:14:22.826559 BGP SEND message type 3 (Notification) length 21 Aug 10 17:14:22.826598 BGP SEND Notification code 6 (Cease) subcode 4 (Administratively Reset) Aug 10 17:14:22.831756 bgp_peer_mgmt_clear:5829: NOTIFICATION sent to 192.168.40.4 (Internal AS 17): code 6 (Cease) subcode 4 (Administratively Reset), Reason: Management session cleared BGP neighbor Aug 10 17:14:22.831851 bgp_send: sending 21 bytes to 192.168.40.4 (Internal AS 17) Aug 10 17:14:22.831901 Aug 10 17:14:22.831901 BGP SEND 192.168.6.5+53889 -> 192.168.40.4+179 Aug 10 17:14:22.831959 BGP SEND message type 3 (Notification) length 21 Aug 10 17:14:22.831999 BGP SEND Notification code 6 (Cease) subcode 4 (Administratively Reset) ...
ログ ファイルの出力をフィルタします。
user@host> file show /var/logical-systems/A/log/bgp-log | match "flags 0x40" Aug 10 17:14:54.867460 BGP SEND flags 0x40 code Origin(1): IGP Aug 10 17:14:54.867595 BGP SEND flags 0x40 code ASPath(2) length 0: <null> Aug 10 17:14:54.867650 BGP SEND flags 0x40 code NextHop(3): 192.168.6.5 Aug 10 17:14:54.867692 BGP SEND flags 0x40 code LocalPref(5): 100 Aug 10 17:14:54.884529 BGP RECV flags 0x40 code Origin(1): IGP Aug 10 17:14:54.884581 BGP RECV flags 0x40 code ASPath(2) length 0: <null> Aug 10 17:14:54.884628 BGP RECV flags 0x40 code NextHop(3): 192.163.6.4 Aug 10 17:14:54.884667 BGP RECV flags 0x40 code LocalPref(5): 100 Aug 10 17:14:54.911377 BGP RECV flags 0x40 code Origin(1): IGP Aug 10 17:14:54.911422 BGP RECV flags 0x40 code ASPath(2) length 0: <null> Aug 10 17:14:54.911466 BGP RECV flags 0x40 code NextHop(3): 192.168.40.4 Aug 10 17:14:54.911507 BGP RECV flags 0x40 code LocalPref(5): 100 Aug 10 17:14:54.916008 BGP SEND flags 0x40 code Origin(1): IGP Aug 10 17:14:54.916054 BGP SEND flags 0x40 code ASPath(2) length 0: <null> Aug 10 17:14:54.916100 BGP SEND flags 0x40 code NextHop(3): 192.168.6.5 Aug 10 17:14:54.916143 BGP SEND flags 0x40 code LocalPref(5): 100 Aug 10 17:14:54.920304 BGP RECV flags 0x40 code Origin(1): IGP Aug 10 17:14:54.920348 BGP RECV flags 0x40 code ASPath(2) length 0: <null> Aug 10 17:14:54.920393 BGP RECV flags 0x40 code NextHop(3): 10.0.0.10 Aug 10 17:14:54.920434 BGP RECV flags 0x40 code LocalPref(5): 100
トレース操作をリアルタイムで表示します。
user@host> clear bgp neighbor logical-system A Cleared 2 connections
注意:稼働環境BGPネイバー テーブルを消去すると、中断を伴います。
オプションの 一致条件を使用して、 monitor start コマンド を実行 します。
user@host> monitor start A/bgp-log | match 0.0.0.0/0 Aug 10 19:21:40.773467 BGP RECV 0.0.0.0/0 Aug 10 19:21:40.773685 bgp_rcv_nlri: 0.0.0.0/0 Aug 10 19:21:40.773778 bgp_rcv_nlri: 0.0.0.0/0 belongs to meshgroup Aug 10 19:21:40.773832 bgp_rcv_nlri: 0.0.0.0/0 qualified bnp->ribact 0x0 l2afcb 0x0
Esc-Q を 押して monitor コマンドを一時停止します。 出力を終了するには、もう一度 Esc-Q を押します。
Enter を 押して monitor stop を入力し、monitor コマンド を停止します。
[Enter] user@host> monitor stop
トラブルシューティングが完了したら、システム リソースに不要な影響を与えしないように、トレース ロギングの非アクティブ化を検討してください。
[edit protocols bgp group internal-peers] user@host:A# deactivate traceoptions user@host:A# commit
設定が非アクティブ化されると、非アクティブなタグを持つ設定に 表示 されます。トレース操作を再度有効化するには、設定モード ステートメント を アクティブ化します。
[edit protocols bgp group internal-peers] user@host:A# show type internal; inactive: traceoptions { file bgp-log size 10k files 2; flag update detail; flag all; } local-address 192.168.6.5; export send-direct; neighbor 192.163.6.4; neighbor 192.168.40.4;
トレース操作を再度有効化するには、設定モード ステートメント を アクティブ化します。
[edit protocols bgp group internal-peers] user@host:A# activate traceoptions user@host:A# commit
トレース ロギングの非アクティブ化と再有効化
手順
トレース ファイルを非アクティブにして再度有効化するには、以下の方法で行います。
トラブルシューティングが完了したら、システム リソースに不要な影響を与えしないように、トレース ロギングの非アクティブ化を検討してください。
[edit protocols bgp group internal-peers] user@host:A# deactivate traceoptions user@host:A# commit
設定が非アクティブ化されると、非アクティブなタグを持つ設定内にステートメント が表示 されます。
[edit protocols bgp group internal-peers] user@host:A# show type internal; inactive: traceoptions { file bgp-log size 10k files 2; flag update detail; flag all; } local-address 192.168.6.5; export send-direct; neighbor 192.163.6.4; neighbor 192.168.40.4;
ロギングを再アクティブ化するには 、activate configuration-mode ステートメントを使用します。
[edit protocols bgp group internal-peers] user@host:A# activate traceoptions user@host:A# commit
結果
設定モードから、 show logical-systems A プロトコル bgp グループ internal-peers コマンドを入力して設定を確認 します。出力結果に意図した設定結果が表示されない場合は、この例の手順を繰り返して設定を修正します。
user@host# show logical-systems A protocols bgp group internal-peers traceoptions { file bgp-log size 10k files 2; flag update detail; }