Saturday, July 10, 2010

Structure of an SNMP UDP datagram packet

So, I was searching the web trying to find a good example of how an SNMP datagram is encoded. I found plenty of RFC's but none of it really helped me wrap my brain around it. Then I stumbled upon this site. http://www.rane.com/note161.html

The most helpful bit was a flash graphic you could enlarge for easier reading. A screen capture of it is below.

It gives you a great graphical representation of how the SNMP is really an assortment of objects wrapped up inside of a parent object. I should be able to use this to write code that will let me decode simple SNMP get-responses for the information I need.

I still don't understand 100% how to encode the integer number 2680 in the OID into the correct byte values but at least now I have a grasp of how the SNMP information is encoded. If anyone can show me an example of how to "programmatically" encode the 2680 in the example shown I'd be much appreciative. For now, I use Wireshark to find out what the encoded value should be.

2 comments:

  1. Some time ago, I wrote up the process of Ber encoding a number greater than 127.

    ReplyDelete
  2. Thanks for this, really helping me to get my head round SNMP packets...

    Since getting into electronics I've wanted to make a nice big internet traffic meter to go on the wall, so I'm trying to get an Arduino to query my router for bytesIn/bytesOut. Had the same problems you did with the RFCs, I reckon. Really handy to have an explanation of what's actually going on :)

    ReplyDelete