Le protocole

Les multiples versions

Commençons par le plus désagréable. SNMP existe au moins dans les versions 1, 2c, 2 et 3. Comme pour tout protocole, les références sont des RFC. Si vous aimez ce genre de lecture :

Version année RFCs Titre Statut
v1 1990 1155 Structure and Identification of Management Information for TCP/IP-based Internets standard
1156 Management Information Base for network management of TCP/IP-based internets  historique
1157 Simple Network Management Protocol (SNMP) historique
v2c (classic) 1993 1441 Introduction to version 2 of the Internet-standard Network Management Framework  historique, proposé comme standard
1442 Structure of Management Information for version 2 of the Simple Network Management Protocol (SNMPv2) standard proposé, remplacé par RFC-1902
1443 Textual Conventions for version 2 of the Simple Network Management Protocol (SNMPv2) standard proposé, remplacé par RFC-1903
1444 Conformance Statements for version 2 of the Simple Network Management Protocol (SNMPv2)  standard proposé, remplacé par RFC-1904
1445 Administrative Model for version 2 of the Simple Network Management Protocol (SNMPv2) historique
1446 Security Protocols for version 2 of the Simple Network Management Protocol (SNMPv2)  historique
1447 Party MIB for version 2 of the Simple Network Management Protocol (SNMPv2)  historique
1448 Protocol Operations for version 2 of the Simple Network Management Protocol (SNMPv2)  standard proposé, remplacé par RFC-1905
1449 Transport Mappings for version 2 of the Simple Network Management Protocol (SNMPv2)  standard proposé, remplacé par RFC-1906
1450 Management Information Base for version 2 of the Simple Network Management Protocol (SNMPv2) standard proposé, remplacé par RFC-1907
1451 Manager-to-Manager Management Information Base historique
1452 Coexistence between version 1 and version 2 of the Internet-standard Network Management Framework  standard proposé, remplacé par RFC-1908
v2 1996 1901 Introduction to Community-based SNMPv2  historique, proposé comme expérimental
1902 Structure of Management Information for Version 2 of the Simple Network Management Protocol (SNMPv2)  standard, remplacé par RFC-2578
1903 Textual Conventions for Version 2 of the Simple Network Management Protocol (SNMPv2) standard, remplacé par RFC-2579
1904 Conformance Statements for Version 2 of the Simple Network Management Protocol (SNMPv2)  standard, remplacé par RFC-2580
1905 Protocol Operations for Version 2 of the Simple Network Management Protocol (SNMPv2)  (3416) standard, remplacé par RFC-3416
1906 Transport Mappings for Version 2 of the Simple Network Management Protocol (SNMPv2)  (3417) standard, remplacé par RFC-3417
1907 Management Information Base for Version 2 of the Simple Network Management Protocol (SNMPv2) (3418) standard, remplacé par RFC-3418
1908 Coexistence between Version 1 and Version 2 of the Internet-standard Network Management Framework  (2576) standard, remplacé par RFC-2576
v3 1999 2571 An Architecture for Describing SNMP Management Frameworks standard, remplacé par RFC-3411
2572 Message Processing and Dispatching for the Simple Network Management Protocol (SNMP) standard, remplacé par RFC-3412
2573 SNMP Applications standard, remplacé par RFC-3413
2574 User-based Security Model (USM) for version 3 of the Simple Network Management Protocol (SNMPv3) standard, remplacé par RFC-3414
2575 View-based Access Control Model (VACM) for the Simple Network Management Protocol (SNMP)  standard, remplacé par RFC-3415
v2 et v3 2000 2576 Coexistence between Version 1, Version 2, and Version 3 of the Internet-standard Network Management Framework  standard proposé
2002 3411 An Architecture for Describing Simple Network Management Protocol (SNMP) Management Frameworks standard
3412 Message Processing and Dispatching for the Simple Network Management Protocol (SNMP) standard
3413 Simple Network Management Protocol (SNMP) Applications standard
3414 User-based Security Model (USM) for version 3 of the Simple Network Management Protocol (SNMPv3)  standard
3415 View-based Access Control Model (VACM) for the Simple Network Management Protocol (SNMP)  standard
3416 Version 2 of the Protocol Operations for the Simple Network Management Protocol (SNMP)  standard
3417 Transport Mappings for the Simple Network Management Protocol (SNMP) standard
3418 Management Information Base (MIB) for the Simple Network Management Protocol (SNMP)  standard
plus quelques standards proposés mais non encore entérinés à ce jour (juillet 2010)

D'une manière générale, reportez-vous au site rfc-editor pour retrouver les RFC, avec les informations sur leur statut (expérimental, obsolète, actif…)

Comme vous le voyez, il règne la plus grande confusion dans la définition des versions 2 et 3 de SNMP.

La version 2, commencée à être définie en 1996, ne se voit réellement finalisée qu'en décembre 2002, après que la version 3 ait été définie. Ladite version 3, trop récente, n'est pas encore largement utilisée, si bien que c'est la version 1 qui se retrouve être supportée par tous, avec ses (graves) défauts, comme nous le verrons plus loin, ainsi que la v 2c assez généralement supportée. La version 3, la seule qui intègre quelques notions de sécurité, commence tout de même à être supportée sur des équipements récents (ceci est écrit en juillet 2010).

Pour que SNMP fonctionne, il n'y a pas qu'un protocole d'échange à définir. Il y a aussi une standardisation des informations que ce protocole peut transporter. C'est un protocole Internet, il doit être utilisable sur des plates-formes hétérogènes (matériel comme système d'exploitation).

C'est pour cette raison que l'on parlera de MIB (Management Information Base) et de SMI (Structure of Management Information)

Dans ce qui suit, nous nous appuierons principalement sur SNMP v1 ou v2c.

Le protocole lui-même

SNMP tire son « S » du fait qu'il s'appuie sur UDP d'une part, et qu'il ne propose qu'un nombre très restreint de commandes.

Les commandes sont les suivantes (version 1):

Commande Action
get-request Le Manager SNMP demande une information à un agent SNMP
get-next-request Le Manager SNMP demande l'information suivante à l'agent SNMP
set-request Le Manager SNMP met à jour une information sur un agent SNMP
get-reponse L'agent SNMP répond à un get-request ou a un set-request
trap L'agent SNMP envoie une alarme au Manager

Jusque là, c'est on ne peut plus simple. L'agent utilise le port 161 et le manager, le port 162. Graphiquement, ça donne ceci :

Échanges SNMP

Les commandes get-request, get-next-request et set-request sont toutes émises par le manager à destination d'un agent et attendent toutes une réponse get-response de la part de l'agent.

La commande trap est une alerte. Elle est toujours émise par l'agent à destination du manager, et n'attend pas de réponse.

Comme vous le voyez, jusque-là, c'est extrêmement simple. Rassurez-vous, ça va nettement se compliquer avec la MIB et la SMI.