Configuring Basic SNMPv1 Functions
Procedure
- Run:
system-view
The system view is displayed.
- (Optional) Run:
snmp-agent
The SNMP agent function is enabled.
By default, the SNMP agent function is disabled. Executing the snmp-agent command can enable the SNMP agent function no matter whether parameters are specified in the command.
- Run:
snmp-agent sys-info version v1
The SNMP version is set to SNMPv1.
By default, SNMPv3 is enabled.
After SNMPv1 is enabled, the managed devices support SNMPv1 and SNMPv3 and can be monitored and managed by both SNMPv1 and SNMPv3 NMSs.
- Run:
snmp-agent community { read | write } { community-name | cipher community-name }
The community name is set.
The community name will be saved in encrypted format in the configuration file.
The Switch has the following requirements for community name complexity:
The default minimum length of a community name is six characters. The set password min-length command determines the minimum length of a community name.
A community name includes at least two kinds of characters, which can be uppercase letters, lowercase letters, digits, and special characters except question marks (?) and spaces.
After the read-and-write community name is set, the NMS with this name has the right of the Viewdefault view (OID: 1.3.6.1). To change the access right of the NMS, see Restricting Management Rights of the NMS.Ensure that the community name of the NMS is the same as that set on the agent. If the NMS and the agent have different community names, the NMS cannot access the agent.
- Run:
Before configuring a device to send traps, confirm that the information center has been enabled. If the information center is not enabled, run the info-center enable command to enable it.
snmp-agent target-host trap address udp-domain ip-address [ udp-port port-number ] [ source interface-type interface-number ] [ public-net | vpn-instance vpn-instance-name ] params securityname { security-name | cipher security-name } [ v1 ] [ ext-vb ]
The destination IP address of traps and error codes is configured.
Note the following when running the command:
The default destination UDP port number is 162. To ensure secure communication between the NMS and managed devices, run the udp-port command to change the UDP port number to a non-well-known port number.
The parameter securityname identifies devices that send traps on the NMS.
If trap messages sent from the managed device to the NMS need to be transmitted over a public network, the parameter public-net needs to be configured. If trap messages sent from the managed device to the NMS need to be transmitted over a private network, the parameter vpn-instance vpn-instance-name needs to be configured to specify a VPN that will take over the transmission task.
- (Optional) Run:
snmp-agent sys-info { contact contact | location location }
The equipment administrators contact information or location is configured.
By default, the vendor's contact information is "R&D Beijing, Huawei Technologies co.,Ltd.". The default location is "Beijing China".
This step is required for the NMS administrator to view contact information and locations of the equipment administrator when the NMS manages many devices. This helps the NMS administrator to contact the equipment administrators for fault location and rectification.
- (Optional) Run:
snmp-agent packet max-size byte-count
The maximum size of SNMP messages is set.
By default, the maximum size of SNMP messages is 12000 bytes.
When the size of an SNMP message is larger than the configured value, the device discards the SNMP message. To ensure that NMS can process SNMP packets properly, set the parameter byte-count based on the maximum size of an SNMP packet that the NMS can process.