25.2 Protocol

25.2 Protocol

SNMP defines only five types of messages that are exchanged between the manager and agent.

  1. Fetch the value of one or more variables : the get “request operator.

  2. Fetch the next variable after one or more specified variables: the get “next “request operator. (We describe what we mean by "next" later in this chapter.)

  3. Set the value of one or more variables: the set “request operator.

  4. Return the value of one or more variables: the get “response operator. This is the message returned by the agent to the manager in response to the get “request, get “next “request, and set “request operators.

  5. Notify the manager when something happens on the agent: the trap operator.

The first three messages are sent from the manager to the agent, and the last two are from the agent to the manager. (We'll refer to the first three as the get, get “next, and set operators.) Figure 25.1 summarizes these five operators.

Figure 25.1. Summary of the five SNMP operators.
graphics/25fig01.gif

Since four of the five SNMP messages are simple request “reply protocols (the manager sends a request, the agent sends back a reply) SNMP uses UDP. This means that a request from the manager may not arrive at the agent, and the agent's reply may not make it back to the manager. The manager probably wants to implement a timeout and retransmission.

The manager sends its three requests to UDP port 161. The agent sends traps to UDP port 162. By using two different port numbers , a single system can easily run both a manager and an agent. (See Exercise 25.1.)

Figure 25.2 shows the format of the five SNMP messages, encapsulated in a UDP datagram.

Figure 25.2. Format of the five SNMP messages.
graphics/25fig02.gif

In this figure we specify the size in bytes of the IP and UDP headers only. This is because the encoding used for the SNMP message ”called ASN.1 and BER, which we describe later in this chapter ”varies depending on the type of variable and its value.

The version is 0. This value is really the version number minus one, as the version of SNMP that we describe is called SNMPv1.

Figure 25.3 shows the values for the PDU type. (PDU stands for Protocol Data Unit, a fancy word for "packet.")

Figure 25.3. PDU types for SNMP messages.
graphics/25fig03.gif

The community is a character string that is a cleartext password between the manager and agent. A common value is the 6-character string public.

For the get, get “next, and set operators, the request ID is set by the manager, and returned by the agent in the get “response message. We've seen this type of variable with other UDP applications. (Recall the DNS identification field in Figure 14.3, and the transaction ID field in Figure 16.2.) It lets the client (the manager in this case) match the responses from the server (the agent) to the queries that the client issued. This field also allows the manager to issue multiple requests to one or more agents , and then be able to sort out the returned replies.

The error status is an integer returned by the agent specifying an error. Figure 25.4 shows the values, names , and descriptions.

Figure 25.4. SNMP error status values.
graphics/25fig04.gif

If an error occurred, the error index is an integer offset specifying which variable was in error. It is set by the agent only for the noSuchName, badValue, and readOnly errors.

A list of variable names and values follows in the get, get “next, and set requests. The value portion is ignored for the get and get “next operators.

For the trap operator (a PDU type of 4), the format of the SNMP message changes. We describe the fields in the trap header when we describe this operator in Section 25.10.



TCP.IP Illustrated, Volume 1. The Protocols
TCP/IP Illustrated, Vol. 1: The Protocols (Addison-Wesley Professional Computing Series)
ISBN: 0201633469
EAN: 2147483647
Year: 1993
Pages: 378

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net