概要

    このドキュメントでは、SNMPを使用してCisco Nexusスイッチのトラブルシューティングと設定方法について説明します

    背景

    Nexusスイッチの設定は、SNMPアクセスが可能であれば変更できます

    これは、すべてのNexusプラットフォームに適用されます。

    使用するコンポーネント

    バージョン5.1(3)が稼働するNexus 5000スイッチ 

    このドキュメントの情報は、特定のラボ環境にあるデバイスに基づいて作成されました。このドキュメントで使用するすべてのデバイスは、初期(デフォルト)設定の状態から起動しています。対象のネットワークが実稼働中である場合には、どのようなコマンドについても、その潜在的な影響について確実に理解しておく必要があります。

    SNMPを使用したアクセスリカバリ

    デバイスのデフォルトvrfにはL3インターフェイス(Mgmt 0以外)があります

    TFTPサーバは、デフォルトのvrfを介してこのスイッチからアクセスでき、TFTFサーバで認証が無効になっている必要があります

    Nexusデバイスは、SNMPv2の読み取り/書き込みコミュニティまたはV3ユーザで設定する必要があります

    AAA認証を無効にする必要がある

    次のスイッチ設定 

    スイッチの設定には、適用されたACLが含まれており、デバイスへのアクセスを防止します

    N5K(config)# sh run int mgmt0
    version 5.1(3)N2(1)
    interface mgmt0
    description “Testing with snmpv3"
    ip access-group filter_internal_snmp_i in
    vrf member management
    ip address10.22.65.39/25

    ステップ1:Nexusスイッチの実行コンフィギュレーションを変更またはロールバックするコマンドを使用して、コンフィギュレーションファイルを作成します。

    次の例は、Mgmt 0ポートに適用されたACLを削除するためのコンフィギュレーションファイルの内容を示しています 

    interface mgmt0
    no ip access-group filter_internal_snmp_i in

    デバイスのローカル認証にAAA設定をリセットする別の例

    aaa authentication login local

    ステップ2:ファイルの保存先.config拡張子を作成し、TFTPアプリケーションのbootディレクトリまたはhomeディレクトリ内に配置します

    ステップ3:デバイスへのSNMPウォークを実行して、到達可能性とSNMP経由のアクセス可能性を確認します

    $ ./snmpwalk  -v2c -c  
           
             
             
              
           
             
             
              1.3.6.1.4.1.9.9.96.1.1.1.1.10.222

    ステップ4- 次のコマンドを実行しますsnmp-serverから(強調表示されているものは実際の値に置き換える必要があります)

    snmp v2の使用

    $ snmpset -v2c -c  
           
             
             
              
           
             
             
              1.3.6.1.4.1.9.9.96.1.1.1.1.14.222 i  5
    $ snmpset -v2c -c 1.3.6.1.4.1.9.9.96.1.1.1.1.2.222 i 1
    $ snmpset -v2c -c 1.3.6.1.4.1.9.9.96.1.1.1.1.3.222 i  1
    $ snmpset -v2c -c 1.3.6.1.4.1.9.9.96.1.1.1.1.4.222 i  4
    $ snmpset -v2c -c 1.3.6.1.4.1.9.9.96.1.1.1.1.5.222 a
    $ snmpset -v2c -c 1.3.6.1.4.1.9.9.96.1.1.1.1.6.222 s <switch.config>
    $ snmpset -v2c -c 1.3.6.1.4.1.9.9.96.1.1.1.1.14.222 i  1
    $ ./snmpwalk  -v2c -c 1.3.6.1.4.1.9.9.96.1.1.1.1.10.222

    SNMPv3の使用

    snmpset -v3 -l authNoPriv -u  
          
            
            
             -a MD5 -A  
          
            
            
              
          
            
            
             .1.3.6.1.4.1.9.9.96.1.1.1.1.14.222 integer 6   ( to  destroy any previous row )
    snmpset -v3 -l authNoPriv -u -a MD5 -A .1.3.6.1.4.1.9.9.96.1.1.1.1.2.222 integer 1 .1.3.6.1.4.1.9.9.96.1.1.1.1.3.222 integer 1 .1.3.6.1.4.1.9.9.96.1.1.1.1.4.222 integer 4 .1.3.6.1.4.1.9.9.96.1.1.1.1.5.222 a .1.3.6.1.4.1.9.9.96.1.1.1.1.6.222 s "switch.config" .1.3.6.1.4.1.9.9.96.1.1.1.1.14.222 integer
    SNMPv2-SMI::enterprises.9.9.96.1.1.1.1.2.222 = INTEGER: 1
    SNMPv2-SMI::enterprises.9.9.96.1.1.1.1.3.222 = INTEGER: 1
    SNMPv2-SMI::enterprises.9.9.96.1.1.1.1.4.222 = INTEGER: 4
    SNMPv2-SMI::enterprises.9.9.96.1.1.1.1.5.222 = IpAddress:
    SNMPv2-SMI::enterprises.9.9.96.1.1.1.1.6.222 = STRING: "switch.config"
    SNMPv2-SMI::enterprises.9.9.96.1.1.1.1.14.222 = INTEGER: 4

    SNMPv3の手順

    snmpset -v3 -l authNoPriv -u admin -a MD5 -A ******* 10.22.65.39 .1.3.6.1.4.1.9.9.96.1.1.1.1.14.222 integer 6   ( to  destroy any previous row )
    snmpset -v3 -l authNoPriv -u admin -a MD5 -A ******* 10.22.65.39 .1.3.6.1.4.1.9.9.96.1.1.1.1.2.222 integer 1 .1.3.6.1.4.1.9.9.96.1.1.1.1.3.222 integer 1 .1.3.6.1.4.1.9.9.96.1.1.1.1.4.222 integer 4 .1.3.6.1.4.1.9.9.96.1.1.1.1.5.222 a 172.18.108.26 .1.3.6.1.4.1.9.9.96.1.1.1.1.6.222 s "switch.config" .1.3.6.1.4.1.9.9.96.1.1.1.1.14.222 integer 4
    SNMPv2-SMI::enterprises.9.9.96.1.1.1.1.2.222 = INTEGER: 1
    SNMPv2-SMI::enterprises.9.9.96.1.1.1.1.3.222 = INTEGER: 1
    SNMPv2-SMI::enterprises.9.9.96.1.1.1.1.4.222 = INTEGER: 4
    SNMPv2-SMI::enterprises.9.9.96.1.1.1.1.5.222 = IpAddress: 172.16.1.1
    SNMPv2-SMI::enterprises.9.9.96.1.1.1.1.6.222 = STRING: "switch.config"
    SNMPv2-SMI::enterprises.9.9.96.1.1.1.1.14.222 = INTEGER: 4

    回避策の後にスイッチ設定を行う

    N5K-1(config)# sh run int mgmt0
    version 5.1(3)N2(1)
    interface mgmt0
    description “Testing with snmpv3"
    vrf member management
    ip address 10.22.65.39/25

    アカウンティングログを調べて、コマンドが実行されたかどうかを確認することもできます。SNMPによって行われた設定変更は、Rootユーザとして表示されます。

    N5K-1(config)# sh accounting log
    Mon Aug  6 17:07:37 2018:type=start:id=vsh.5777:user=root:cmd
    Mon Aug  6 17:07:37 2018:type=update:id=vsh.5777:user=root:cmd=configure terminal ; interface mgmt0 (SUCCESS)
    Mon Aug  6 17:07:37 2018:type=update:id=vsh.5777:user=root:cmd=configure terminal ; interface mgmt0 ; no ip access-group filter_internal_snmp_i in (SUCCESS)
    Mon Aug  6 17:07:37 2018:type=stop:id=vsh.5777:user=root:cmd=

    手順5:SSH/Telnetを使用して、デバイスへのアクセスを確認します

    SNMPを使用した設定

    次のようなコンフィギュレーションファイル

    switch3.config:

    vrf context management
    ip route 0.0.0.0/0 10.128.164.1
    end

    SNMPコマンドセット

    $ snmpset -v2c -c TEST 10.10.10.1 1.3.6.1.4.1.9.9.96.1.1.1.1.14.222 integer 6  ( to clear any previous line)
    SNMPv2-SMI::enterprises.9.9.96.1.1.1.1.14.222 = INTEGER: 6
    $ snmpset -v2c -c TEST 10.10.10.1 .1.3.6.1.4.1.9.9.96.1.1.1.1.2.222 integer 1 .1.3.6.1.4.1.9.9.96.1.1.1.1.3.222 integer 1 .1.3.6.1.4.1.9.9.96.1.1.1.1.4.222 integer 4 .1.3.6.1.4.1.9.9.96.1.1.1.1.5.222 a 172.18.108.26 .1.3.6.1.4.1.9.9.96.1.1.1.1.6.222 s "switch3.config" .1.3.6.1.4.1.9.9.96.1.1.1.1.14.222 integer 4
    SNMPv2-SMI::enterprises.9.9.96.1.1.1.1.2.222 = INTEGER: 1
    SNMPv2-SMI::enterprises.9.9.96.1.1.1.1.3.222 = INTEGER: 1
    SNMPv2-SMI::enterprises.9.9.96.1.1.1.1.4.222 = INTEGER: 4
    SNMPv2-SMI::enterprises.9.9.96.1.1.1.1.5.222 = IpAddress: 172.18.108.26
    SNMPv2-SMI::enterprises.9.9.96.1.1.1.1.6.222 = STRING: "switch3.config"
    SNMPv2-SMI::enterprises.9.9.96.1.1.1.1.14.222 = INTEGER: 4

    アカウンティングログ

    Mon Sep 3 15:15:35 2018:type=update:id=snmp_62528_10.82.250.52:user=TEST:cmd=copy tftp://172.18.108.26:69switch3.config running-config vrf management (SUCCESS)
    Mon Sep 3 15:15:35 2018:type=start:id=vsh.12593:user=root:cmd=
    Mon Sep 3 15:15:35 2018:type=update:id=vsh.12593:user=root:cmd=configure terminal ; vrf context management (SUCCESS)
    Mon Sep 3 15:15:35 2018:type=update:id=vsh.12593:user=root:cmd=configure terminal ; vrf context management ; ip route 0.0.0.0/0 10.128.164.1 (SUCCESS)
    Mon Sep 3 15:15:35 2018:type=stop:id=vsh.12593:user=root:cmd=

    参考

    Nexusセキュリティ設定ガイド

    NXOSパスワード回復