V-TEK Weblog about webdevelopment and linux

21Oct/080

SNMP explained

Due to a project I'm working on for XXL Webhosting, I decided to write a little explanation of SNMP ( Simple Network Management Protocol ).

In this post you can read the basics of SNMP and the usage of it. After this post I will write a post about implementing your own variables into SNMP so that you can extend the default variables of SNMP.

So what's it all about?
SNMP is the Simple Network Management Protocol. This protocol is used by network admins to manage their networks in a fast and easy way. Fast because SNMP takes less bandwidth and easy because most hardware (like routers, switches, APC's, servers, etc.) have native SNMP support that can be enabled and configured like the way the admin wants it.

Are there any alternatives?
Yes, these days there is one alternative called CMIP ( Common Management Information Protocol ). CMIP is most often used in telecommunication applications, in other areas SNMP has become more popular. But in this post, we'll stick to SNMP.

SNMP Advantages
The most import advantage of SNMP is that it is easy to implement. Another big advantage is that SNMP uses very less bandwidth. It's even possible for a network manager to insert it's own variables into SNMP. A SNMP variable consists of the following parts:

  1. The name of the variable
  2. The data type of the variable ( for example, INTEGER, COUNTER or STRING )
  3. If the variable is readable, or if its writable
  4. The value of the variable.

More about the extending of SNMP in my next post.

SNMP Disadvantages
Like most things also SNMP has it's disadvantages. The first problem of SNMP is the variety of security leaks in the software which can be used by hackers to gain information about the network. It's even possible to shutdown terminals using SNMP (!). Happily after all the version 2 of SNMP has some major improvements like privacy ( the privacy of data), authentication (users must be authenticated to gain data) , access control ( users can be restricted by the information they request ).

So how does SNMP works?
Good question. SNMP works by sending and receiving network information using messages ( also knows as PDU's - Protocol Data Units ) .
The SNMP agent works like a server that is providing the variables, which can be requested by a SNMP manager. This connection works in two ways:

  1. The manager can make a request to the agent to request a certain value ( pull )
  2. The agent can send a message to the manager ( push )

It's also possible to let the manager assign a value to the agent (write).

Most of the values that can be retrieved have a relationship to data send by a variety of protocols. To read these variables, the TCP/IP network consists of 3 parts:

  1. A Management Information Base ( MIB ) which specifies the variables that the network element has.
  2. An identification scheme which is used to refer to the variables in the MIB. This is called the Structure of Management Information (SMI)
  3. The Simple Network Management Protocol that's between the network element and the manager.

The SNMP protocol consists of 5 types of messages (PDU's) which are send between the manager and the agent. The 5 types are:

  1. get request
  2. get next-request
  3. set request
  4. get-response
  5. trap

The first 3 types (1-3) are being used by retrieving information from the agent to the manager ( pull ). The last 2 types are being used from the agent towards the manager (push). I will explain these later in this post...

Scheme of SNMP
Because of the fact that an agent and a manager using different portnumbers you can easily setup an agent and a manager on the same system.
Technical detail here is that the communication of SNMP is done using UDP. You can find a little port scheme below (including the port numbers).

f8_1.gif

Get and get-next requests
The get and get-next requests in the scheme above are requests to a specific value of one variable which has been collected by the agent. The agent itselves sends, in answer to the request, a response with the value of this variable.

Set request
The set request is a request from the manager to the agent to provide a certain variable with a new value. If the manager is allowed to set this variable, then the agent sends back the new value of the variable. 

Trap message
Other then the ones specified above, this message is not requested from the manager, but send from the agent itselves. These messages are sent to the manager if the agent is rebooted or if there is a link down.


Object Identifiers

The SNMP manager and agent are working with object identifiers. These identifiers are dot-seperated values of numbers which represent a certain path. In the scheme below shows a structure. As you can see, the value 1.3.6.1.2.1 belongs to the path “ iso.org.dod.internet.mgmt.mib “

f8_2.gif

Like I said before, SNMP has also the possibility to create your own variables. They can be programmed into  “iso.org.dod.internet.private.enterprises “ (1.3.6.1.4.1)

Hope that clears up the air for you readers. If not feel free to use one of the links below:

Tagged as: , Leave a comment
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


No trackbacks yet.