RELATED links:
SNMP Learning Notes
Using snmp4j to implement SNMP functions (i)
Using snmp4j to implement SNMP functions (II.)
Using snmp4j to implement SNMP functions (iii)
SNMP is the abbreviation of "Simple Network Management Protocol" in English, and the Chinese meaning is "Easy network Management Protocol". SNMP is currently the most commonly used environmental management protocol. SNMP is designed to be protocol-independent, so it can be used on Ip,ipx,appletalk,osi and other transport protocols used. SNMP is a series of protocol groups and specifications that provide a way to collect network management information from devices on a network. SNMP also provides a way for the device to report problems and errors to the network management workstation.
At present, almost all network equipment manufacturers have achieved the support of SNMP. Leading-stream SNMP is a public communication protocol that collects and manages information from devices on the network. The manager of the device collects this information and records it in the management Information base (MIB). This information reports on the device's characteristics, data throughput, communication overload, and errors. MIB has a public format, so SNMP management tools from multiple vendors can collect MIB information and are presented to system administrators on the management console.
SNMP provides a unified, cross-platform approach to device management.
The concept is too abstract to look at an example first.
Let's do one of the simplest SNMP operations: Get the machine name of a machine, assuming its IP is 192.168.1.1.
The first step is to install the SNMP environment to 192.168.1.1. The Windows Component's Management monitoring tool contains SNMP, which can only be installed. SNMP default communication port is 161/162, some systems need to manually set up, this can be achieved by creating a filter list, specific how to set up a lot of online, you can go to search. In addition, you need to close the 192.168.1.1 Firewall.
Next need to be able to carry on SNMP communication tool, relatively simple have snmputil, everybody can go to download on the net.
The Snmputil command rules are:
Snmputil [Get|getnext|walk] Agent Community OID [OID ...]
[Get|getnext|walk] is the message type, the operation we are doing is get
Agent refers to the IP or name of the network device that you want to operate, that is, the 192.168.1.1
Community: Sub-area, that is, password, default is public
OID: The MIB data object number to be manipulated, and the MIB object number corresponding to the device name is. 1.3.6.1.2.1.1.5.0
Open the Command Line window, enter the path where Snmputil is located, and type
Snmputil get 192.168.1.1 public. 1.3.6.1.2.1.1.5.0
If the parameters are correct, the console displays the 192.168.1.1 machine name.
I do not know whether there is a perceptual understanding of SNMP, through the get, set such operations, we can read, control network equipment.
Let's learn some basic concepts related to SNMP.
models for agents and management stations
SNMP is divided into 2 roles: SNMP Management station (manager, our native 127.0.0.1) and SNMP agent (agent, the machine we operate, such as 192.168.1.1). The agent is the part of the actual network device that is used to implement the SNMP function. The agent receives a read and write request message from the NMS at Port 161 of UDP, and manages the event notification message that receives the agent at Port 162 on UDP. Therefore, once you gain access to the device (community, the default is public), you can access device information, overwrite, and configure device parameters. Because of the UDP protocol, there is no need to maintain a connection between the agent and the management station.
SNMP Operation Commands
The SNMP protocol is easy to use because it provides three basic operational commands for controlling MIB objects. They are: Get, Set, and Trap.
Get: Management station reads the value of an object at the agent. It is the most used command in the SNMP protocol because it is the basic way to obtain management information from a network device.
Set: The management station sets the value of the object at the agent. It is a privileged command because it can be used to change the configuration of the device or to control the operation of the device. It can set the name of the device, turn off a port or clear an entry in an Address resolution table, and so on.
Trap: The agent proactively informs the management station of important events. It is the function of the network management system is not clearly required under the premise of the management agent to notify the network management system has some special situation or problems occurred. If an unexpected situation occurs, the customer sends a message to the server's 162 port informing the server that the specified variable value has changed. Data that is typically obtained by a server request is received by the server's 161 port. Trap messages can be used to notify management station of line failures, connection terminals and recovery, authentication failures, and other messages. The management station may handle accordingly.
SNMP Commands and Messages
The SNMP protocol defines the format of the packet and the exchange of information between the network administrator and the management agent, and it controls the MIB data object of the management agent. Therefore, you can use to handle the various tasks defined by the administrative agent.
An SNMP message consists of three parts: The Version field, the Community field, and the SNMP Protocol Data Unit field (SNMP Protocol Data Units field), and the packet length is not fixed.
Version domain: This field is used to describe which version of the SNMP protocol is currently in use. Currently, version 1 is the most widely used SNMP protocol.
Subregion: Partitioning (community) is a basic security mechanism for authenticating SNMP network administrators when accessing SNMP management agents. is similar to a password, the default value is public. The partition name (Community name) is the password for the administrative agent, and the administrator is allowed to access the data object if the network administrator knows the password of the network agent. If the configuration management agent can execute the trap command, the system sends a autenticationfailure trap message when the network administrator queries the management agent with an incorrect partition name.
PDU : Protocol data Unit. is the data area in the SNMP message, which is the carrier of the SNMP communication times text data.
MIB: Management Information Base
The Management Information Database (MIB) is an information repository that contains data about configuration and performance in the management agent, an organizational system and a public structure that contains many data objects that are divided into different groups.
MIB data objects are organized in a tree-like hierarchy in which each branch of the tree has a dedicated name and a numeric identifier. The branching of a structure tree actually represents a logical grouping of data objects. The leaves, sometimes called nodes, represent the individual data objects. A subtree is used in the structure tree to represent an increased middle branch and an increased leaf.
Using this tree hierarchy, MIB browsers can access the entire MIB database in a convenient and concise manner. MIB Browser is a tool that traverses the entire MIB tree and usually represents the various branches and leaf objects in the form of a graphical display. The data object in the MIB can be found by its numeric identifier, which starts at the top (or root) of the structure tree until each leaf node (that is, the data object). This type of access is consistent with the way the file system is organized. The main difference is that the pathname in the file system can be represented in absolute or relative terms, while MIB data objects can only be represented in absolute terms and cannot be used in a relative way.
Each node has an object identifier (OID) that uniquely identifies each node in both numbers and characters, where the object identifier OID is a set of integers separated by a period, that is, the path from the root node to it. A labeled node can have a subtree that contains other labeled nodes, and if there is no subtree it is a leaf node that contains a value and is called an object. For example, the OID of the network device name is. 1.3.6.1.2.1.1.5.0, whose value is a string of the device name.
network resources are abstracted as objects for management. However, an object in SNMP is a data variable representing a particular aspect of the resource being regulated. Objects are standardized as classes across systems, and collections of objects are organized into management information bases (MIB). MIB as a collection of management station access points located at the agent, the management station carries out network monitoring by reading the value of the objects in the MIB. The management station can generate actions at the agent, or change the configuration of the agent by modifying the value of the variable.
These are some of the most basic concepts of SNMP, more in-depth application next time.