After basic SNMPv2c functions are configured, an NMS can perform basic operations on a managed device, and the managed device can send alarms to the NMS.
Sends requests to the managed device to perform the GetRequest, GetNextRequest, GetResponse, GetBulk, or SetRequest operation, obtaining data and setting values.
SNMPv2c has a security risk. Using SNMPv3 is recommended.
Receives alarms from the managed device and locates and rectify device faults based on the alarm information.
system-view
info-center enable
By default, the information center is enabled.
snmp-agent
By default, the SNMP agent function is disabled. Running any command with the parameter snmp-agent can enable the SNMP agent function, so this step is optional.
snmp-agent udp-port port-num
By default, port 161 is monitored by the SNMP agent.
The snmp-agent udp-port command can be used to change the number of the port monitored by the SNMP agent, to improve the security of the device.
snmp-agent sys-info version v2c
By default, SNMPv3 is enabled.
After SNMPv2c is enabled on the managed device, the device supports both SNMPv2c and SNMPv3. This means that the device can be monitored and managed by NMSs running SNMPv2c and SNMPv3.
snmp-agent community { read | write } [ cipher ] community-name [ acl acl-number | mib-view view-name | alias alias-name ] *
The community name will be saved in encrypted format in the configuration file. The community alias will be saved in simple text format in the configuration file.
The requirements for community name complexity are as follows:
The default minimum length of a community name is eight 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 space.
After the community name is set, if no MIB view is configured, the NMS that uses the community name has permission to access objects in the ViewDefault view.
The differences between traps and informs are as follows:
The traps sent by the managed device do not need to be acknowledged by the NMS.
The informs sent by the managed device need to be acknowledged by the NMS. If no acknowledgement message from the NMS is received within a specified time period, the managed device will resend the inform until the number of retransmissions reaches the maximum.
When the managed device sends an inform, it records the inform in the log. If the NMS and link between the NMS and managed device recovers from a fault, the NMS can still learn the inform sent during the fault occurrence and rectification.
In this regard, informs are more reliable than traps, but the device may need to buffer a lot of informs because of the inform retransmission mechanism and this may consume many memory resources.
If the network is stable, using traps is recommended. If the network is unstable and the device's memory capacity is sufficient, using informs is recommended.
Informs and traps must have different destination IP addresses. If a same destination IP address is configured for both of them, the later configuration overrides the previous configuration.
To configure a destination IPv4 address for the traps and error codes sent from the device, run:
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 [ cipher ] security-string [ v2c | notify-filter-profile profile-name | private-netmanager | ext-vb ] *
To configure a destination IPv4 address for the informs and error codes sent from the device, run:
snmp-agent target-host inform address udp-domain ip-address [ udp-port port-number | source interface-type interface-number | [ public-net | vpn-instance vpn-instance-name ] ] * params securityname { security-string | cipher security-string } v2c [ notify-filter-profile profile-name | ext-vb ] *
To configure a destination IPv6 address for the alarms and error codes sent from the device, run:
snmp-agent target-host trap ipv6 address udp-domain ipv6-address [ udp-port port-number ] params securityname [ cipher ] security-string [ v2c | notify-filter-profile profile-name | private-netmanager | ext-vb ] *
The default destination User Datagram Protocol (UDP) port number is 162. In some special cases, the parameter udp-port can be used to specify a non-well-known UDP port number. This ensures normal communication between the NMS and managed device.
If the alarms 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 the alarms 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 used to specify a VPN that will take over the sending task.
The parameter securityname identifies the alarm sender, which will help you learn the alarm source.
If the NMS and managed device are both Huawei products, the parameter private-netmanager can be configured to add more information to alarms, such as the alarm type, alarm sequence number, and alarm sending time. The information will help you locate and rectify faults more quickly.
An IPv6 network supports only traps, not informs.
snmp-agent sys-info { contact contact | location location }
This step is required when the NMS administrator must know equipment administrators' contact information and locations when the NMS manages many devices. This allows the NMS administrator to contact the equipment administrators quickly for fault location and rectification.
To configure both the equipment administrator's contact information and location, you must run the command twice to configure them separately.
snmp-agent packet max-size byte-count
By default, the maximum size of an SNMP packet that the device can receive or send is 12000 bytes.
After the maximum size is set, the device will discard any SNMP packet that is larger than the set size. The allowable maximum size of an SNMP packet for a device depends on the size of a packet that the NMS can process; otherwise, the NMS cannot process the SNMP packets sent from the device.
snmp-agent protocol source-interface interface-type interface-number
Currently, the source interface can be set only to a loopback interface.
snmp-agent protocol server [ ipv4 | ipv6 ] disable
By default, the SNMP IPv4 or IPv6 listening port is disabled.
If ipv4 or ipv6 is not selected, both SNMP IPv4 and IPv6 listening ports are disabled.
After you disable the SNMP IPv4 or IPv6 listening port using the snmp-agent protocol server disable command, SNMP no longer processes SNMP packets. Exercise caution when you disable the SNMP IPv4 or IPv6 listening port.
To allow a specified NMS that uses the community name to manage specified objects on the device, follow the procedure described in Controlling the NM Station's Access to the Device.
To allow a specified module on the managed device to report alarms to the NMS, follow the procedure described in Configuring the Trap Function.
If the NMS and managed device are both Huawei products, follow the procedure described in Enabling the SNMP Extended Error Code Function to allow the device to send more types of error codes. This allows more specific error identification and facilitates your fault location and rectification.
To improve Simple Network Management Protocol (SNMP) packet transmission reliability, follow the procedure described in Improving SNMP Packet Transmission Reliability.