Experience cases of using snmpwalk to read device MIB nodes and delete snmp configuration

2023-12-27 19:58:10 Published
  • 0 Followed
  • 0Collected ,4010Browsed

Network Topology

Any H3C V7 version device and a PC can be directly connected to the device and can communicate with each other.

Problem Description

1. How to use snmpwalk to read the MIB node of the device?

When we get the OID node of a device, how can we confirm whether the node can be read correctly on the device? When there is no management platform, we can use snmpwalk to read it. You can download it from the net-snmp official website.

 

2. How to correctly delete the snmp configuration?

We often encounter snmp configurations that cannot be deleted, or after deletion, snmp-agent is reconfigured and all appear again. Reading this case may help you.

Process Analysis

1.      Use snmpv2 to read the MIB node of the device

H3C Comware Software, Version 7.1.064, Release 5458P03

Copyright (c) 2004-2022 New H3C Technologies Co., Ltd. All rights reserved.

H3C WX3840H uptime is 10 weeks, 5 days, 6 hours, 37 minutes

Last reboot reason : Power on

#

 snmp-agent

 snmp-agent local-engineid 800063A280782C2956534500000001

snmp-agent community write private

snmp-agent community read public

snmp-agent sys-info version all

 snmp-agent target-host trap address udp-domain 172.16.1.xx params securityname public v2c

#

The V2 command is relatively simple. You only need to specify the community name to be read, followed by the OID node value to be read. For example:

Windows PowerShell

PS C:\Users\zhoutian> snmpWALK -v 2c -c public 192.168.1.5 1.3.6.1.4.1.25506.2.75.2.1.2.1

Cannot find module (IP-MIB): At line 0 in (none)

Cannot find module (IF-MIB): At line 0 in (none)

Cannot find module (TCP-MIB): At line 0 in (none)

Cannot find module (UDP-MIB): At line 0 in (none)

Cannot find module (HOST-RESOURCES-MIB): At line 0 in (none)

Cannot find module (SNMPv2-MIB): At line 0 in (none)

Cannot find module (SNMPv2-SMI): At line 0 in (none)

Cannot find module (NOTIFICATION-LOG-MIB): At line 0 in (none)

Cannot find module (UCD-SNMP-MIB): At line 0 in (none)

Cannot find module (UCD-DEMO-MIB): At line 0 in (none)

Cannot find module (SNMP-TARGET-MIB): At line 0 in (none)

Cannot find module (NET-SNMP-AGENT-MIB): At line 0 in (none)

Cannot find module (DISMAN-EVENT-MIB): At line 0 in (none)

Cannot find module (SNMP-VIEW-BASED-ACM-MIB): At line 0 in (none)

Cannot find module (SNMP-COMMUNITY-MIB): At line 0 in (none)

Cannot find module (UCD-DLMOD-MIB): At line 0 in (none)

Cannot find module (SNMP-FRAMEWORK-MIB): At line 0 in (none)

Cannot find module (SNMP-MPD-MIB): At line 0 in (none)

Cannot find module (SNMP-USER-BASED-SM-MIB): At line 0 in (none)

Cannot find module (SNMP-NOTIFICATION-MIB): At line 0 in (none)

Cannot find module (SNMPv2-TM): At line 0 in (none)

iso.3.6.1.4.1.25506.2.75.2.1.2.1.2.20.50.49.57.56.48.49.65.50.51.86.56.50.49.66.69.48.48.51.80.49 = IpAddress: 192.168.10.59

iso.3.6.1.4.1.25506.2.75.2.1.2.1.2.20.50.49.57.56.48.49.65.50.75.50.80.50.50.54.48.48.48.48.71.86 = IpAddress: 192.168.10.2

iso.3.6.1.4.1.25506.2.75.2.1.2.1.3.20.50.49.57.56.48.49.65.50.51.86.56.50.49.66.69.48.48.51.80.49 = Hex-STRING: 00 DD B6 BD 28 C0

iso.3.6.1.4.1.25506.2.75.2.1.2.1.3.20.50.49.57.56.48.49.65.50.75.50.80.50.50.54.48.48.48.48.71.86 = Hex-STRING: 58 B3 8F 67 07 30

iso.3.6.1.4.1.25506.2.75.2.1.2.1.4.20.50.49.57.56.48.49.65.50.51.86.56.50.49.66.69.48.48.51.80.49 = INTEGER: 23

iso.3.6.1.4.1.25506.2.75.2.1.2.1.4.20.50.49.57.56.48.49.65.50.75.50.80.50.50.54.48.48.48.48.71.86 = INTEGER: 23

iso.3.6.1.4.1.25506.2.75.2.1.2.1.5.20.50.49.57.56.48.49.65.50.51.86.56.50.49.66.69.48.48.51.80.49 = INTEGER: 3

iso.3.6.1.4.1.25506.2.75.2.1.2.1.5.20.50.49.57.56.48.49.65.50.75.50.80.50.50.54.48.48.48.48.71.86 = INTEGER: 3

iso.3.6.1.4.1.25506.2.75.2.1.2.1.6.20.50.49.57.56.48.49.65.50.51.86.56.50.49.66.69.48.48.51.80.49 = STRING: "6330"

iso.3.6.1.4.1.25506.2.75.2.1.2.1.6.20.50.49.57.56.48.49.65.50.75.50.80.50.50.54.48.48.48.48.71.86 = STRING: "6636"

iso.3.6.1.4.1.25506.2.75.2.1.2.1.7.20.50.49.57.56.48.49.65.50.51.86.56.50.49.66.69.48.48.51.80.49 = INTEGER: 0

iso.3.6.1.4.1.25506.2.75.2.1.2.1.7.20.50.49.57.56.48.49.65.50.75.50.80.50.50.54.48.48.48.48.71.86 = INTEGER: 0

iso.3.6.1.4.1.25506.2.75.2.1.2.1.8.20.50.49.57.56.48.49.65.50.51.86.56.50.49.66.69.48.48.51.80.49 = STRING: "6330"

iso.3.6.1.4.1.25506.2.75.2.1.2.1.8.20.50.49.57.56.48.49.65.50.75.50.80.50.50.54.48.48.48.48.71.86 = STRING: "6636"

iso.3.6.1.4.1.25506.2.75.2.1.2.1.9.20.50.49.57.56.48.49.65.50.51.86.56.50.49.66.69.48.48.51.80.49 = STRING: "WA6330"

iso.3.6.1.4.1.25506.2.75.2.1.2.1.9.20.50.49.57.56.48.49.65.50.75.50.80.50.50.54.48.48.48.48.71.86 = STRING: "WA6636"

iso.3.6.1.4.1.25506.2.75.2.1.2.1.10.20.50.49.57.56.48.49.65.50.51.86.56.50.49.66.69.48.48.51.80.49 = STRING: "wa6300.ipe"

iso.3.6.1.4.1.25506.2.75.2.1.2.1.10.20.50.49.57.56.48.49.65.50.75.50.80.50.50.54.48.48.48.48.71.86 = STRING: "wa6600.ipe"

iso.3.6.1.4.1.25506.2.75.2.1.2.1.11.20.50.49.57.56.48.49.65.50.51.86.56.50.49.66.69.48.48.51.80.49 = STRING: "V200R001B64D029SP5803"

iso.3.6.1.4.1.25506.2.75.2.1.2.1.11.20.50.49.57.56.48.49.65.50.75.50.80.50.50.54.48.48.48.48.71.86 = STRING: "V200R001B64D029SP5803"

iso.3.6.1.4.1.25506.2.75.2.1.2.1.12.20.50.49.57.56.48.49.65.50.51.86.56.50.49.66.69.48.48.51.80.49 = IpAddress: 255.255.255.0

iso.3.6.1.4.1.25506.2.75.2.1.2.1.12.20.50.49.57.56.48.49.65.50.75.50.80.50.50.54.48.48.48.48.71.86 = IpAddress: 255.255.255.0

iso.3.6.1.4.1.25506.2.75.2.1.2.1.13.20.50.49.57.56.48.49.65.50.51.86.56.50.49.66.69.48.48.51.80.49 = INTEGER: 975

iso.3.6.1.4.1.25506.2.75.2.1.2.1.13.20.50.49.57.56.48.49.65.50.75.50.80.50.50.54.48.48.48.48.71.86 = INTEGER: 847

iso.3.6.1.4.1.25506.2.75.2.1.2.1.14.20.50.49.57.56.48.49.65.50.51.86.56.50.49.66.69.48.48.51.80.49 = INTEGER: 5

iso.3.6.1.4.1.25506.2.75.2.1.2.1.14.20.50.49.57.56.48.49.65.50.75.50.80.50.50.54.48.48.48.48.71.86 = INTEGER: 6

iso.3.6.1.4.1.25506.2.75.2.1.2.1.15.20.50.49.57.56.48.49.65.50.51.86.56.50.49.66.69.48.48.51.80.49 = INTEGER: 6

iso.3.6.1.4.1.25506.2.75.2.1.2.1.15.20.50.49.57.56.48.49.65.50.75.50.80.50.50.54.48.48.48.48.71.86 = INTEGER: 5

iso.3.6.1.4.1.25506.2.75.2.1.2.1.16.20.50.49.57.56.48.49.65.50.51.86.56.50.49.66.69.48.48.51.80.49 = INTEGER: 1

iso.3.6.1.4.1.25506.2.75.2.1.2.1.16.20.50.49.57.56.48.49.65.50.75.50.80.50.50.54.48.48.48.48.71.86 = INTEGER: 1

iso.3.6.1.4.1.25506.2.75.2.1.2.1.17.20.50.49.57.56.48.49.65.50.51.86.56.50.49.66.69.48.48.51.80.49 = ""

iso.3.6.1.4.1.25506.2.75.2.1.2.1.17.20.50.49.57.56.48.49.65.50.75.50.80.50.50.54.48.48.48.48.71.86 = ""

iso.3.6.1.4.1.25506.2.75.2.1.2.1.18.20.50.49.57.56.48.49.65.50.51.86.56.50.49.66.69.48.48.51.80.49 = INTEGER: 2

iso.3.6.1.4.1.25506.2.75.2.1.2.1.18.20.50.49.57.56.48.49.65.50.75.50.80.50.50.54.48.48.48.48.71.86 = INTEGER: 12

iso.3.6.1.4.1.25506.2.75.2.1.2.1.19.20.50.49.57.56.48.49.65.50.51.86.56.50.49.66.69.48.48.51.80.49 = STRING: "H3C"

iso.3.6.1.4.1.25506.2.75.2.1.2.1.19.20.50.49.57.56.48.49.65.50.75.50.80.50.50.54.48.48.48.48.71.86 = STRING: "H3C"

iso.3.6.1.4.1.25506.2.75.2.1.2.1.20.20.50.49.57.56.48.49.65.50.51.86.56.50.49.66.69.48.48.51.80.49 = INTEGER: 1048576

iso.3.6.1.4.1.25506.2.75.2.1.2.1.20.20.50.49.57.56.48.49.65.50.75.50.80.50.50.54.48.48.48.48.71.86 = INTEGER: 1048576

iso.3.6.1.4.1.25506.2.75.2.1.2.1.21.20.50.49.57.56.48.49.65.50.51.86.56.50.49.66.69.48.48.51.80.49 = INTEGER: 1073741824

iso.3.6.1.4.1.25506.2.75.2.1.2.1.21.20.50.49.57.56.48.49.65.50.75.50.80.50.50.54.48.48.48.48.71.86 = INTEGER: 1073741824

iso.3.6.1.4.1.25506.2.75.2.1.2.1.22.20.50.49.57.56.48.49.65.50.51.86.56.50.49.66.69.48.48.51.80.49 = INTEGER: 131072

iso.3.6.1.4.1.25506.2.75.2.1.2.1.22.20.50.49.57.56.48.49.65.50.75.50.80.50.50.54.48.48.48.48.71.86 = INTEGER: 262144

iso.3.6.1.4.1.25506.2.75.2.1.2.1.23.20.50.49.57.56.48.49.65.50.51.86.56.50.49.66.69.48.48.51.80.49 = INTEGER: 134217728

iso.3.6.1.4.1.25506.2.75.2.1.2.1.23.20.50.49.57.56.48.49.65.50.75.50.80.50.50.54.48.48.48.48.71.86 = INTEGER: 268435456

iso.3.6.1.4.1.25506.2.75.2.1.2.1.24.20.50.49.57.56.48.49.65.50.51.86.56.50.49.66.69.48.48.51.80.49 = STRING: "Version 7.1.064, Release 2458P03"

iso.3.6.1.4.1.25506.2.75.2.1.2.1.24.20.50.49.57.56.48.49.65.50.75.50.80.50.50.54.48.48.48.48.71.86 = STRING: "Version 7.1.064, Release 2458P03"

iso.3.6.1.4.1.25506.2.75.2.1.2.1.25.20.50.49.57.56.48.49.65.50.51.86.56.50.49.66.69.48.48.51.80.49 = INTEGER: 511

iso.3.6.1.4.1.25506.2.75.2.1.2.1.25.20.50.49.57.56.48.49.65.50.75.50.80.50.50.54.48.48.48.48.71.86 = INTEGER: 479

iso.3.6.1.4.1.25506.2.75.2.1.2.1.26.20.50.49.57.56.48.49.65.50.51.86.56.50.49.66.69.48.48.51.80.49 = STRING: "ARM, 1500"

iso.3.6.1.4.1.25506.2.75.2.1.2.1.26.20.50.49.57.56.48.49.65.50.75.50.80.50.50.54.48.48.48.48.71.86 = STRING: "ARM, 1700"

iso.3.6.1.4.1.25506.2.75.2.1.2.1.27.20.50.49.57.56.48.49.65.50.51.86.56.50.49.66.69.48.48.51.80.49 = STRING: "DDR4"

iso.3.6.1.4.1.25506.2.75.2.1.2.1.27.20.50.49.57.56.48.49.65.50.75.50.80.50.50.54.48.48.48.48.71.86 = STRING: "DDR3"

iso.3.6.1.4.1.25506.2.75.2.1.2.1.28.20.50.49.57.56.48.49.65.50.51.86.56.50.49.66.69.48.48.51.80.49 = INTEGER: 2

iso.3.6.1.4.1.25506.2.75.2.1.2.1.28.20.50.49.57.56.48.49.65.50.75.50.80.50.50.54.48.48.48.48.71.86 = INTEGER: 12

 

2.      Delete the SNMP configuration of a device

1) This configuration cannot be deleted by directly undoing snmp-agent. This command only disables the snmp module of the device, rather than deleting the configuration. The previous configuration will reappear the next time snmp-agent is enabled, so it needs to be deleted one by one.

2) There is also a difficulty in deleting one by one. For example, if you want to delete the following configuration, you will find that the last user-role is not allowed to be deleted. This is specified. Users created in RBAC mode, the last user-role is not allowed to be deleted. So how can this last configuration (snmp-agent usm-user v3 Snmpv3mgr user-role 2001 cipher authentication-mode md5) be deleted? You need to directly undo this RBAC user, as follows: undo snmp-agent usm-user v3 Snmpv3mgr local, this will achieve the deletion effect.

Solution

Referring to the above method, you can read the OID node of the device and satisfy the addition and deletion of snmp configuration. It is very useful when trying to see whether the device has the OID node.

Please rate this case:   
0 Comments

No Comments

Add Comments: