サービスの改善にご協力お願いします。

お客様のご意見をお聞かせください。

アンケートの所要時間はおよそ 2 分です。

header-navigation
keyboard_arrow_up
close
keyboard_arrow_left
ネットワーク管理と監視ガイド
Table of Contents Expand all
list Table of Contents

この機械翻訳はお役に立ちましたでしょうか?

starstarstarstarstar
Go to English page
免責事項:

このページは、サードパーティー製機械翻訳ソフトウェアを使用して翻訳されます。質の高い翻訳を提供するために合理的な対応はされていますが、ジュニパーネットワークスがその正確性を保証することはできかねます。この翻訳に含まれる情報の正確性について疑問が生じた場合は、英語版を参照してください. ダウンロード可能なPDF (英語版のみ).

Junos OS で SNMP を設定する

date_range 19-Jan-25

SNMPを設定する

SNMP は、QFX シリーズおよび OCX シリーズ製品で実行されている Junos OS ソフトウェア に実装することができます。デフォルトでは、SNMP は有効にされていません。SNMPを有効にするには、 [edit]階層レベルにSNMP設定ステートメントを含める必要があります。

SNMPの最小要件を設定するには、[edit  snmp]階層レベルでステートcommunity publicメントを記述します。

完全なSNMP機能を設定するには、snmpを参照してください。

[edit snmp] 階層レベルの設定ステートメント

このトピックでは、 階[edit snmp]層レベルと設定階層におけるそのレベルでのすべての設定ステートメントを紹介します。Junos OS を設定する場合、現在の階層レベルは user@host# プロンプトの前の行のバナーに表示されます。

content_copy zoom_out_map
[edit]
snmp {
        alarm-management {
            alarm-list-name list-name {
                alarm-id id {
                    alarm-state state {
                        description alarm-description;
                        notification-id notification-id-of-alarm;
                        resource-prefix alarm-resource-prefix;
                        varbind-index varbind-index-in-alarm-varbind-list;
                        varbind-subtree alarm-varbind-subtree;
                        varbind-value alarm-varbind-value;
                    }
                }
            }
        }
    client-list client-list-name {
        ip-addresses;
    }
    community community-name {
        authorization authorization;
        client-list-name client-list-name;
        clients {
            address <restrict>;
        }
        logical-system logical-system-name {
            routing-instance routing-instance-name;
            clients {
                address <restrict>;
            }
        }
        routing-instance routing-instance-name {
            clients {
                address <restrict>;
            }
        }
        view view-name;
    }
    contact contact;
    description description;
    engine-id {
        (local engine-id | use-default-ip-address | use-mac-address);
    }
    filter-duplicates;
    interface [ interface-names ];
    location location;
    name name;
    nonvolatile {
        commit-delay seconds;
    }
      {rmon {
        alarm index {
            description description;
            falling-event-index index;
            falling-threshold integer;
            falling-threshold-interval seconds;
            interval seconds;
            request-type (get-next-request | get-request | walk-request);
            rising-event-index index;
            rising-threshold integer;
            sample-type type;
            startup-alarm alarm;
            syslog-subtag syslog-subtag;
            variable oid-variable;
        }
        event index {
            community community-name;
            description description;
            type type;
        }
    }
    traceoptions {
        file filename <files number> <size size> <world-readable | no-world-readable> <match regular-expression>;
        flag flag;
        memory-trace;
        no-remote-trace;
        no-default-memory-trace;
    }
    trap-group group-name {
        categories {
            category;
        }
        destination-port port-number;
        routing-instance instance;
        logical-system logical-system-name;
        targets {
            address;
        }
        version (all | v1 | v2);
    }
    trap-options {
        agent-address outgoing-interface;
        source-address address;
        enterprise-oid; 
        logical-system logical-system-name {
            routing-instance routing-instance-name {
                source-address address;
            }
        }
        routing-instance routing-instance-name {
            source-address address;
        }
    }
    v3 {
        notify name {
            tag tag-name;
            type (trap | inform);
        }
        notify-filter profile-name {
            oid oid (include | exclude);
        }
        snmp-community community-index {
            community-name community-name;
            security-name security-name;
            tag tag-name;
        }
        target-address target-address-name {
            address address;
            address-mask address-mask;
            logical-system logical-system;
            port port-number;
            retry-count number;
            routing-instance instance;
            tag-list tag-list;
            target-parameters target-parameters-name;
            timeout seconds;
        }
        target-parameters target-parameters-name {
            notify-filter profile-name;
            parameters {
                message-processing-model (v1 | v2c | v3);
                security-level (authentication | none | privacy);
                security-model (usm | v1 | v2c);
                security-name security-name;
            }
        }
        usm {
            local-engine {
                user username {
                    authentication-md5 {
                        authentication-password authentication-password;
                    }
                    authentication-none;
                    authentication-sha {
                        authentication-password authentication-password;
                    }
                    privacy-3des {
                        privacy-password privacy-password;
                    }
                    privacy-aes128 {
                        privacy-password privacy-password;
                    }
                    privacy-des {
                        privacy-password privacy-password;
                    }
                    privacy-none;
                }
            }
        }
        vacm {
            access {
                group group-name {
                    (default-context-prefix | context-prefix context-prefiix){
                        security-model (any | usm | v1 | v2c) {
                            security-level (authentication | none | privacy) {
                                notify-view view-name;
                                read-view view-name;
                                write-view view-name;
                            }
                        }
                    }
                }
            }
            security-to-group {
                security-model (usm | v1 | v2c) {
                    security-name security-name {
                        group group-name;
                    }
                }
            }
        }
    }
    view view-name {
        oid object-identifier (include | exclude);
    }
}
注:

Junos OSおよびJunos OS Evolved Release 22.2R1以降、パケットサイズオプションが[edit snmp]階層下のCLIで有効にされます。

SNMPの基本的な設定を設定する

以下のセクションには、SNMP基本設定についての情報と、Junos OSを実行するデバイス上でSNMP基本操作を設定するいくつかの例が含まれています。

SNMPv1とSNMPv2の基本的な設定を設定する

デフォルトでJunos OSを実行しているデバイスでは、SNMPを有効にすることはできません。Junos OSを実行するデバイスでSNMPを有効にするには、[edit  snmp]階層レベルでステートcommunity publicメントを含めます。

SNMPv1およびSNMPv2のGetとGetNext操作の有効化

content_copy zoom_out_map
[edit]
snmp {
    community public;
}

パブリックとして定義されたコミュニティでは、すべてのMIBデータへのアクセスを任意のクライアントに許可します。

デバイス上でSNMPv1およびSNMPv2のSet操作を有効にするには、[edit snmp]階層レベルで以下のステートメントを含める必要があります。

SNMPv1およびSNMPv2のSet操作の有効化

content_copy zoom_out_map
[edit snmp]
view all {
    oid .1;
}
community private {
    view all;
    authorization read-write;
}

以下の例は、SNMPv1およびSNMPv2トラップのデバイスでの基本的な最小設定を示しています。

SNMPv1およびSNMPv2トラップの設定

content_copy zoom_out_map
[edit snmp]
trap-group jnpr {
    targets {
        192.168.69.179;
    }
}

SNMPv3の基本的な設定を設定する

以下の例は、GetGetNext、およびSetの操作をデバイス上で有効にするSNMPv3の最小設定を示しています(構成ではmd5への認証およびnoneへのプライバシーが設定されていることに注意してください)。

SNMPv3のGet、GetNext、Set操作の有効化

content_copy zoom_out_map
[edit snmp]
v3 {
    usm {
        local-engine {
            user jnpruser {
                authentication-md5 {
                    authentication-key "$9$guaDiQFnAuOQzevMWx7ikqP"; ## SECRET-DATA
                }
                privacy-none;
            }
        }
    }
    vacm {
        security-to-group {
            security-model usm {
                security-name jnpruser {
                    group grpnm;
                }
            }
        }
        access {
            group grpnm {
                default-context-prefix {
                    security-model any {
                        security-level authentication {
                            read-view all;
                            write-view all;
                        }
                    }
                }
            }
        }
    }
}
view all {
    oid .1;
}

以下の例は、デバイスでのSNMPv3インフォームの基本設定を示しています(構成ではnoneへの認証とプライバシーが設定されています)。

SNMPv3インフォームの設定

content_copy zoom_out_map
[edit snmp]
v3 {
    usm {
        remote-engine 00000063200133a2c0a845c3 {
            user RU2_v3_sha_none {
                authentication-none;
                privacy-none;
            }
        }
    }
    vacm {
        security-to-group {
            security-model usm {
                security-name RU2_v3_sha_none {
                    group g1_usm_auth;
                }
            }
        }
        access {
            group g1_usm_auth {
                default-context-prefix {
                    security-model usm {
                        security-level authentication {
                            read-view all;
                            write-view all;
                            notify-view all;
                        }
                    }
                }
            }
        }
    }
    target-address TA2_v3_sha_none {
        address 192.168.69.179;
        tag-list tl1;
        address-mask 255.255.252.0;
        target-parameters TP2_v3_sha_none;
    }
    target-parameters TP2_v3_sha_none {
        parameters {
            message-processing-model v3;
            security-model usm;
            security-level none;
            security-name RU2_v3_sha_none;
        }
        notify-filter nf1;
    }
    notify N1_all_tl1_informs {
        type inform; # Replace inform with trap to convert informs to traps.
        tag tl1;
    }
    notify-filter nf1 {
        oid .1 include;
    }
}
view all {
    oid .1 include;
}

以下の例に示すように、階層レベルのステートメントのtypetrapをに設定することで、SNMPv3インフォームをトラ[edit snmp v3 notify N1_all_tl1_informs]ップに変換できます。

インフォームをトラップに変換

content_copy zoom_out_map
user@host# set snmp v3 notify N1_all_tl1_informs type trap

SNMPの詳細を設定する

SNMP を使って、コンタクト名やデバイスの場所など、基本的な管理情報を格納できます。管理システムは、トラブルシューティングや監査を行う際に、この情報をリモートで取得できます。SNMP用語では、MIB-2のシステムグループ内(RFC 1213、TCP/IPベースのインターネットのネットワーク管理のための管理情報ベースで定義されている)にあるsysName、sysContact、sysDescription、sysLocationオブジェクトです。MIB-II で定義されています)。SNMP で管理するシステムごとに、Junos OS 構成内で初期値を直接設定できます。

注:

SNMP によって管理されるデバイスについては、名前、場所、連絡先、説明情報を常に保管および更新します。

SNMPの詳細を設定するには:

  1. システム名を設定します。
    [edit snmp]層レベルでステートnameメントを含めて、システム名の詳細を設定します。
    content_copy zoom_out_map
    [edit snmp]
    user@host# set name name
    

    たとえば、以下のように表示されます。

    content_copy zoom_out_map
    [edit snmp]
    user@host# set name "host” # Overrides the system name
    
  2. システム連絡先を設定します。
    システム コンタクト詳細を設定するには、ここに示すように、contact ステートメントを [edit snmp] 階層レベルまたは適切な構成グループに含めます。

    この管理用コンタクトは、MIB II sysContact オブジェクト内に配置されます。

    名前にスペースが含まれている場合、引用符(" ")で囲みます。

    content_copy zoom_out_map
    [edit snmp]
    user@host# set contact contact
    

    たとえば、以下のように表示されます。

    content_copy zoom_out_map
    [edit snmp]
    user@host# set contact "Enterprise Support, (650) 555-1234" # Specifies the name and phone number of the
    administrator.
    
  3. システムの説明を構成します。

    この文字列は、MIB II sysDescriptionオブジェクトに置かれます。説明にスペースが含まれている場合は、引用符(" ")で囲みます。

    content_copy zoom_out_map
    [edit snmp]
    user@host# set description description
    

    たとえば、以下のように表示されます。

    content_copy zoom_out_map
    [edit snmp]
    user@host# set description "M10i router with 8 FPCs" # Specifies the description for the device.
    
  4. システムの場所を構成します。

    この文字列は、MIB II sysLocation オブジェクトに置かれます。場所にスペースが含まれている場合、引用符(" ")で囲みます。

    システム説明を指定するには:

    content_copy zoom_out_map
    [edit]
    snmp {
        location "Row 11, Rack C";
    }
    
    content_copy zoom_out_map
    [edit snmp]
    user@host# set location location
    

    たとえば、以下のように表示されます。

    content_copy zoom_out_map
    [edit snmp] 
    user@host# set location "London Corporate Office, Lab 5, Row 11, Rack C" # Specifies the location of the device.
    
  5. 設定をコミットします。
    content_copy zoom_out_map
    user@host# commit
    
  6. 構成を検証するには、show snmp mib walk system operational-mode コマンドを入力します。

    コマshow snmp mib walk systemンドは、システム テーブルの MIB ウォーク スルーを実行します(RFC 1213 で定義された MIB-2 から)。Junos OS の SNMP エージェントは、テーブルの各行とそれに関連する値を出力することで応答します。同じコマンドを使って、エージェントがサポートする MIB ツリーのどの部分でも MIB ウォークを実行できます。

    content_copy zoom_out_map
    user@host> show snmp mib walk system
    sysDescr.0    = M10i router with 8 FPCs
    sysObjectID.0 = jnxProductNameM10i
    sysUpTime.0   = 173676474
    sysContact.0  = Enterprise Support, (650) 555-1234
    sysName.0     = host
    sysLocation.0 = London Corporate Office, Lab 5, Row 11, Rack C
    sysServices.0 = 4

コミット遅延タイマーを設定する

ルーターやスイッチが最初にSNMP不揮発性 Set リクエストを受信すると、Junos OSの XMLプロトコル セッションが開き、他のユーザーやアプリケーションが候補の構成を変更することを防ぎます(コマンドライン インターフェイス [CLI] configure exclusive コマンドと同等)。候補の設定がコミットされている間にルーターが新しいSNMP Set リクエストを受信した場合、SNMP Set リクエストは拒否され、エラーが発生します。5 秒が経過する前にルーターが新しい SNMP Set リクエストを受信した場合、コミット遅延タイマー(最後の SNMP リクエストを受信してからコミットがリクエストされるまでの時間)は 5 秒にリセットされます。

デフォルトでは、タイマーは 5 秒に設定されています。SNMP Set リプライとコミット開始のタイマーを構成するには、commit-delay ステートメントを [edit snmp nonvolatile] 階層レベルで記述します。

content_copy zoom_out_map
[edit snmp nonvolatile]
commit-delay seconds;

seconds は、候補の構成の SNMP リクエストを受信してからコミットが要求されるまでの時間の長さです。configure exclusive コマンドの詳細および構成のロックについては、Junos OS CLI ユーザー ガイドを参照してください。

Junos OSを搭載したデバイスでのSNMPの設定

Junos OS を搭載したデバイスでは、デフォルトで SNMP が無効になっています。ルーターやスイッチで SNMP を有効にするには、[edit snmp] 階層レベルで SNMP 設定ステートメントを含める必要があります。

SNMPの最小要件を設定するには、[edit  snmp]階層レベルでcommunity publicステートメントを記述します。

ここで public と定義されたコミュニティは、すべての MIB データへの読み取りアクセスを任意のクライアントに許可します。

すべてのSNMP機能を設定するには、[edit snmp] 階層レベルで以下のステートメントを含めます。

content_copy zoom_out_map
snmp {
    client-list client-list-name {
        ip-addresses;
    }
    community community-name {
        authorization authorization;
        client-list-name client-list-name;
        clients {
            address restrict;
        }
        routing-instance routing-instance-name {
            clients {
            addresses;
            }
        }
        logical-system logical-system-name {
            routing-instance routing-instance-name {
                clients {
                addresses;
                }
            }
        }
        view view-name;
    }
    contact contact;
    description description;
    engine-id {
        (local engine-id | use-mac-address | use-default-ip-address);
    }
    filter-duplicates;
    health-monitor {
        falling-threshold integer;
        interval seconds;
        rising-threshold integer;
    }
    interface [ interface-names ];
    location location;
    name name;
    nonvolatile {
        commit-delay seconds;
    }
    rmon {
        alarm index {
            description text-description;
            falling-event-index index;
            falling-threshold integer;
            falling-threshold-interval seconds;
            interval seconds;
            request-type (get-next-request | get-request | walk-request);
            rising-event-index index;
            sample-type type;
            startup-alarm alarm;
            syslog-subtag syslog-subtag;
            variable oid-variable;
        }
        event index {
            community community-name;
            description text-description;
            type type;
        }
    }
    traceoptions {
        file filename <files number> <size size> <world-readable | no-world-readable> <match regular-expression>;
        flag flag;
    }
    trap-group group-name {
        categories {
            category;
        }
        destination-port port-number;
        routing-instance instance;
        targets {
            address;
        }
        version (all | v1 | v2);
    }
    trap-options {
        agent-address outgoing-interface;
        source-address address;
    }
    view view-name {
        oid object-identifier (include | exclude);
    }
}

例:QFabricシステムでSNMPを設定する

Junos OS を搭載したデバイスでは、デフォルトで SNMP が無効になっています。この例では、QFabric システムで SNMP を設定する手順を説明します。

要件

この例では、以下のハードウェアとソフトウェアのコンポーネントを使用しています。

  • Junos OSリリース12.2

  • ネットワーク管理システム(NMS)(SNMP マネージャーを実行中)

  • QFabric システム(SNMP エージェントを実行)と複数の Node デバイス

概要

[edit snmp]階層レベルに設定ステートメントを含めて、デバイスでSNMPを有効にする必要があります。最低限、community public文は設定する必要があります。public と定義されたコミュニティは、任意のクライアントに対して MIB データへの読み取り専用アクセスを許可します。

clients文が設定されていない場合は、すべてのクライアントが許可されます。スイッチへの SNMP クライアントアクセスを制限するために、常にrestrictオプションを含めることをお勧めします。

トポロジー

この例のネットワークトポロジーには、NMS、4 台のノードデバイスを持つ QFabric システム、およびトラップを受信するように構成された外部 SNMP サーバーが含まれています。

設定

手順

CLIクイック構成

この例をすばやく設定するには、次のコマンドをコピーしてテキストファイルに貼り付け、改行を削除して、ネットワーク構成に合わせて必要な詳細を変更し、[edit]階層レベルのCLIにコマンドをコピー&ペーストしてください。

content_copy zoom_out_map
set snmp name “snmp qfabric” description “qfabric0 switch”
set snmp location “Lab 4 Row 11” contact “qfabric-admin@qfabric0”
set snmp community public authorization read-only
set snmp client-list list0 192.168.0.0/24
set snmp community public client-list-name list0
set snmp community public clients 192.170.0.0/24 restrict
set snmp trap-group “qf-traps” destination-port 155 targets 192.168.0.100
ステップバイステップでの手順

次の例では、設定階層内のさまざまなレベルに移動する必要があります。その方法の説明については、Junos OS CLIユーザーガイド設定モードでCLIエディターを使用するを参照してください。

QFabric システムで SNMP を設定するには、以下の手順に従います。

注:

名前、説明、場所、連絡先、コミュニティ名にスペースが含まれる場合は、テキストを引用符(" ")で囲んでください。

  1. SNMP システム名を設定します。

    content_copy zoom_out_map
    [edit snmp]
    user@switch# set name “snmp qfabric”
    
    注:

    上記の設定されたSNMPシステム名にアクセスする方法:

    • ポリシーオブジェクト識別子(OID)sysName.0に対してSNMPGetで問い合わせを行うことで、ポリシーオブジェクト識別子を取得することができます。

    • 汎用的な jnxSyslogTrap から。jnxSyslogTrap を送信するために、[edit event-options policy]階層でトラップイベントを設定します。

  2. 説明を指定します。

    content_copy zoom_out_map
    [edit snmp]
    user@switch# set description “qfabric0 system”
    

    この文字列は、MIB II sysDescriptionオブジェクトに置かれます。

  3. QFabric システムの物理的な位置を指定します。

    content_copy zoom_out_map
    [edit snmp]
    user@switch# set location “Lab 4 Row 11”
    

    この文字列は、MIB II sysLocation オブジェクトに置かれます。

  4. SNMP システムの管理者連絡先を指定します。

    content_copy zoom_out_map
    [edit snmp]
    user@switch# set contact “qfabric-admin@qfabric0”
    

    この名前は、MIB II sysContact オブジェクトに置かれます。

  5. 一意の SNMP コミュニティ名と読み取り専用の認証レベルを指定します。

    注:

    read-writeオプションは QFabric システムでサポートされていません。

    content_copy zoom_out_map
    [edit snmp]
    user@switch# set community public authorization read-only
    
  6. SNMP コミュニティを使用できる IP アドレスのセットでクライアントリストを作成します。

    content_copy zoom_out_map
    [edit snmp]
    user@switch# set client-list list0 192.168.0.0/24
    user@switch# set community public client-list-name list0
    
  7. コミュニティの利用を制限するクライアントの IP アドレスを指定します。

    content_copy zoom_out_map
    [edit snmp]
    user@switch# set community public clients 198.51.100.0/24 restrict
    
  8. トラップグループ、宛先ポート、トラップグループ内の SNMP トラップを受信する対象を設定します。

    content_copy zoom_out_map
    [edit snmp]
    user@switch# set trap-group “qf-traps” destination-port 155 targets 192.168.0.100
    
    注:

    デフォルトのポート 162 を使用する場合は、destination-port文を含める必要はありません。

    トラップグループ qf-traps は 192.168.0.100 にトラップを送信するように構成されています。

結果

設定モードから、showコマンドを入力して設定を確認します。出力結果に意図した設定内容が表示されない場合は、この例の手順を繰り返して設定を修正します。

content_copy zoom_out_map
[edit]
user@switch# show
    snmp {
        name "snmp qfabric";
        description "qfabric0 system";
        location "Lab 4 Row 11";
        contact "qfabric-admin@qfabric0";
        client-list list0 {
            192.168.0.0/24;
        }
        community public {
            authorization read-only;
            clients {
                198.51.100.0/24 restrict;
            }
        }
        trap-group qf-traps {
            destination-port 155;
            targets {
                192.168.0.100;
            }
        }
    }

デバイスの設定が完了したら、設定モードから commit を入力します。

footer-navigation