Subscribe by Email

Sunday, April 4, 2010

Simple Network Management Protocol Cont...

Follow the Basic Encoding Rules when laying out the bytes of an SNMP message :
- The most fundamental rule states that each field is encoded in three parts: Type, Length, and Data.
- Type specifies the data type of the field using a single byte identifier.
- Length specifies the length in bytes of the following Data section.
- Data is the actual value communicated (the number, string, OID, etc).
- Rule applies when encoding the first two numbers in the OID. According to BER, the first two numbers of any OID (x.y) are encoded as one value using the formula (40*x)+y. The first two numbers in an SNMP OID are always 1.3. Therefore, the first two numbers of an SNMP OID are encoded as 43 or 0x2B, because (40*1)+3 = 43. After the first two numbers are encoded, the subsequent numbers in the OID are each encoded as a byte.
- The rule for large numbers states that only the lower 7 bits in the byte are used for holding the value (0-127). The highest order bit is used as a flag to let the recipient know that this number spans more than one byte. Therefore, any number over 127 must be encoded using more than one byte. According to this rule, the number 2680 must be encoded 0x94 0x78.

SNMP Primitives

SNMP has three control primitives that initiate data flow from the requester which is usually the Manager. These would be get, get-next and set. The manager uses the get primitive to get a single piece of information from an agent. You would use get-next if you had more than one item. You can use set when you want to set a particular value.

SNMP Operation

SNMP design is pretty simple. There are two main players in SNMP. The manager and the agent. The manager is generally the ‘main’ station such as HP Openview. The agent would be the SNMP software running on a client system you are trying to monitor.

No comments:

Facebook activity