Junos OSでSNMPを設定する
SNMPの設定
デバイス上で実行されているJunos OSソフトウェアにSNMPを実装できます。デフォルトでは、SNMPは有効になっていません。SNMPを有効にするには、 [edit] 階層レベルにSNMP設定ステートメントを含める必要があります。
SNMPの最小要件を設定するには、[edit snmp]階層レベルでcommunity publicステートメントを含めます。
完全なSNMP機能を設定するには、 snmpを参照してください。
[edit snmp]階層レベルの設定ステートメント
このトピックでは、 [edit snmp] 階層レベルと設定階層におけるそのレベルでのすべての設定ステートメントを示します。Junos OSを設定する場合、現在の階層レベルは user@host# プロンプトの前の行のバナーに表示されます。
[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 suffix-string | unique-id hex-string | 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-aes128 { 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); } }
SNMPの基本設定を構成する
以下のセクションでは、SNMPの基本設定についての情報と、Junos OSを実行するデバイス上でSNMPの基本的な操作を設定するいくつかの例を示します。
SNMPv1およびSNMPv2の基本設定を構成する
デフォルトでJunos OSを実行しているデバイスでは、SNMPを有効にすることはできません。Junos OSを実行しているデバイスでSNMPを有効にするには、[edit snmp]階層レベルでcommunity publicステートメントを含めます。
SNMPv1およびSNMPv2のGetとGetNext操作の有効化
[edit]
snmp {
community public;
}
パブリックとして定義されたコミュニティは、すべてのMIBデータへのアクセスを任意のクライアントに許可します。
デバイス上でSNMPv1およびSNMPv2の Set 操作を有効にするには、 [edit snmp] 階層レベルで以下のステートメントを含める必要があります。
SNMPv1およびSNMPv2のSet操作の有効化
[edit snmp]
view all {
oid .1;
}
community private {
view all;
authorization read-write;
}
以下の例は、デバイス上のSNMPv1およびSNMPv2トラップの基本的な最小設定を示しています。
SNMPv1およびSNMPv2トラップの設定
[edit snmp]
trap-group jnpr {
targets {
192.168.69.179;
}
}
SNMPv3の基本設定を構成する
以下の例は、デバイス上で Get、 GetNext、および Set 操作を有効にするためのSNMPv3の最小設定を示しています(構成は md5 に設定認証、プライバシーを noneに設定されていることに注意してください)。
SNMPv3のGet、GetNext、Set操作の有効化
[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 インフォームの設定
[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;
}
以下の例に示すように、[edit snmp v3 notify N1_all_tl1_informs]階層レベルのtypeステートメントの値をtrapに設定することで、SNMPv3インフォームをトラップに変換できます。
インフォームをトラップに変換
user@host# set snmp v3 notify N1_all_tl1_informs type trap
関連項目
SNMPの詳細を設定する
SNMP を使用して、連絡先名やデバイスの場所など、基本的な管理情報を保存できます。管理システムは、トラブルシューティングや監査を行う際に、この情報をリモートで取得できます。SNMP 用語では、これらは、MIB-2 のシステム グループ内にある sysName、sysContact、sysDescription、sysLocation オブジェクトです(RFC 1213、 TCP/IP ベースのインターネットのネットワーク管理のための管理情報ベース:MIB-II で定義)。SNMP で管理するシステムごとに、Junos OS 設定内で初期値を直接設定できます。
SNMP によって管理されるデバイスについては、名前、場所、連絡先、説明情報を常に設定および更新します。
SNMPの詳細を設定するには:
コミット遅延タイマーを設定する
ルーターまたはスイッチが最初にSNMP不揮発性 Set 要求を受信すると、Junos OS XMLプロトコルセッションが開き、他のユーザーまたはアプリケーションが候補の設定を変更することを防ぎます(コマンドラインインターフェイス[CLI]コマンドと同等 configure exclusive )。候補の設定がコミットされている間にルーターが新しいSNMP Set 要求を受信した場合、SNMP Set 要求は拒否され、エラーが発生します。5 秒が経過する前にルーターが新しい SNMP Set リクエストを受信した場合、コミット遅延タイマー(最後の SNMP リクエストを受信してからコミットがリクエストされるまでの時間)は 5 秒にリセットされます。
デフォルトでは、タイマーは5秒に設定されています。SNMP Set の応答とコミット開始のタイマーを設定するには、[edit snmp nonvolatile] 階層レベルで commit-delay ステートメントを含めます。
[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] 階層レベルで以下のステートメントを含めます。
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 suffix-string | unique-id hex-string | use-default-ip-address | use-mac-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); } }
関連項目
変更履歴テーブル
サポートされる機能は、使用しているプラットフォームとリリースによって決まります。 機能エクスプローラー を使用して、機能がお使いのプラットフォームでサポートされているかどうかを確認します。
[edit snmp] 階層の下のCLIで有効になります。