SNMP basic configuration instance
Typical configuration of SNMP v1/v2
Networking requirements
NMS is connected to the Agent over Ethernet. The IP address of NMS is 1.1.1.2/24, and the IP address of the Agent is 1.1.1.1/24.
NMS monitors and manages the Agent through SNMP v1 or SNMP v2c. The Agent can report the situation to NMS when a fault or error occurs.
Procedure
(1)
Configure the Agent
# Configure the IP address of the Agent to 1.1.1.1/24, and ensure that the routing between the Agent and NMS is reachable. (Configuration steps are omitted)
# Set Basic SNMP information, including version and group name.
<Sysname> system-view
[Sysname] snmp-agent sys-info version v1 v2c
[Sysname] snmp-agent community read public
[Sysname] snmp-agent community write private
# Set contact and location information for the vswitch for easy maintenance.
[Sysname] snmp-agent sys-info contact Mr. Wang-Tel: 3306
[Sysname] snmp-agent sys-info location telephone-closet, 3rd-floor
# Send Trap packets to the network management station (NMS) 1.1.1.2/24. The group name is public.
[Sysname] snmp-agent trap enable
[Sysname] snmp-agent target-host trap address udp-domain 1.1.1.2 params securityname public v1
The specified version in the snmp-agent target-host command must be the same as the SNMP Version running on NMS. If the NMS runs the SNMP v2c version, set the version parameter in the snmp-agent target-host command to v2c. Otherwise, the network management site will not receive the Trap information.
(2) Configure NMS
You must set "Read-Only group name" and "read/write group name" on NMS that uses SNMP v1/v2c ". In addition, you must set the "timeout" and "Number of retries ". You can use the network management system to query and configure devices. For more information, see the NMS documentation.
(3)
Result Verification
With the above configuration, NMS can establish an SNMP connection with the device, and can query and set the values of certain parameters on the device through the MIB node.
Perform the shutdown/undo shutdown operation on an idle interface on the device. The corresponding Trap information is displayed on NMS.
Typical configuration of SNMP v3
1. Networking requirements
NMS is connected to the Agent over Ethernet. The IP address of NMS is 1.1.1.2/24, and the IP address of the Agent is 1.1.1.1/24.
NMS can only monitor and manage the Agent interface status through SNMP v3. The Agent can report the situation to NMS when a fault or error occurs. The port number of the NMS receiving Trap is 5000.
Authentication is required when NMS establishes an SNMP connection with the Agent. The authentication protocol is MD5 and the password is authkey. The SNMP Packets transmitted between NMS and the Agent must be encrypted. The DES protocol is used, and the encrypted password is prikey.
Procedure
(1) configure the Agent
# Configure the IP address of the Agent to 1.1.1.1/24, and ensure that the routing between the Agent and NMS is reachable. (Configuration steps are omitted)
# Set access permissions: the user can only read and write objects under the node interfaces (OID is 1.3.6.1.2.1.2), but cannot access other MIB objects. The user name is managev3user, the authentication method is MD5, the authentication password is authkey, the encryption algorithm is DES56, And the encryption password is prikey.
<Sysname> system-view
[Sysname] undo snmp-agent mib-view ViewDefault
[Sysname] snmp-agent mib-view included test interfaces
[Sysname] snmp-agent group v3 managev3group read-view test write-view test
[Sysname] snmp-agent usm-user v3 managev3user managev3group authentication-mode md5 authkey privacy-mode des56 prikey
# Set the contact and location information of the device for easy maintenance.
[Sysname] snmp-agent sys-info contact Mr. Wang-Tel: 3306
[Sysname] snmp-agent sys-info location telephone-closet, 3rd-floor
# Send Trap packets to the network management station (NMS) 1.1.1.2/24. The user name is managev3user.
[Sysname] snmp-agent trap enable
[Sysname] snmp-agent target-host trap address udp-domain 1.1.1.2 params securityname managev3user v3 privacy
(2)
Configure NMS
SNMP v3 adopts the authentication and encryption security mechanism. You need to set the user name on NMS and select the security level. You must set the authentication method, authentication password, encryption method, and encryption password based on different security levels. In addition, you must set the "timeout" and "Number of retries ". You can use the network management system to query and configure devices. For more information, see the NMS documentation.
(3)
Result Verification
With the above configuration, NMS can establish an SNMP connection with the device, and can query and set the values of certain parameters on the device through the MIB node.
Perform the shutdown/undo shutdown operation on an idle interface on the device. The corresponding Trap information is displayed on NMS.