Home » SNMP v2c vs v3: Network Monitoring Protocol Deep Dive
SNMP v2c vs v3: Network Monitoring Protocol Deep Dive
SNMP v2c vs v3: Network Monitoring Protocol Deep Dive
SNMP (Simple Network Management Protocol) เป็น protocol มาตรฐานสำหรับ monitor และ manage network devices SNMP v2c ใช้ community strings (plaintext) สำหรับ authentication ส่วน SNMP v3 เพิ่ม authentication (MD5/SHA) และ encryption (DES/AES) ทำให้ secure กว่ามาก SNMP เป็นพื้นฐานของทุก NMS (Network Management System)
SNMP v2c ยังคงถูกใช้มากที่สุดเพราะ ง่ายต่อการ configure แต่ community strings ถูกส่งเป็น plaintext ทำให้ถูก sniff ได้ง่าย SNMP v3 แก้ปัญหา security นี้แต่ config ซับซ้อนกว่า ทุก organization ควรย้ายไป v3 โดยเฉพาะ environments ที่ sensitive
SNMP Versions
| Feature |
SNMPv1 |
SNMPv2c |
SNMPv3 |
| Authentication |
Community string (plaintext) |
Community string (plaintext) |
Username + MD5/SHA (hashed) |
| Encryption |
ไม่มี |
ไม่มี |
DES/3DES/AES-128/256 |
| Access Control |
Community-based |
Community-based |
View-based (VACM) |
| 64-bit Counters |
ไม่มี |
มี (Counter64) |
มี (Counter64) |
| GetBulk |
ไม่มี |
มี (efficient polling) |
มี |
| Inform |
ไม่มี |
มี (acknowledged trap) |
มี |
| Security Level |
ต่ำ |
ต่ำ |
สูง (AuthPriv) |
SNMP Operations
| Operation |
Direction |
ใช้ทำอะไร |
| GET |
Manager → Agent |
อ่านค่า OID เดียว |
| GET-NEXT |
Manager → Agent |
อ่าน OID ถัดไป (walk through MIB tree) |
| GET-BULK |
Manager → Agent |
อ่านหลาย OIDs พร้อมกัน (v2c/v3 only, efficient) |
| SET |
Manager → Agent |
เปลี่ยนค่า OID (config change) |
| TRAP |
Agent → Manager |
Agent ส่ง notification เมื่อเกิด event (unacknowledged) |
| INFORM |
Agent → Manager |
เหมือน TRAP แต่ acknowledged (reliable, v2c/v3) |
| RESPONSE |
Agent → Manager |
ตอบกลับ GET/SET requests |
MIB และ OID
| Concept |
ความหมาย |
ตัวอย่าง |
| MIB (Management Information Base) |
Database ของ objects ที่ manage ได้ |
IF-MIB, HOST-RESOURCES-MIB |
| OID (Object Identifier) |
Unique identifier สำหรับแต่ละ object |
1.3.6.1.2.1.1.1.0 = sysDescr |
| MIB Tree |
Hierarchical structure ของ OIDs |
iso.org.dod.internet.mgmt.mib-2 |
Common OIDs
| OID |
Name |
ใช้ดูอะไร |
| 1.3.6.1.2.1.1.1.0 |
sysDescr |
Device description (OS, model) |
| 1.3.6.1.2.1.1.3.0 |
sysUpTime |
Uptime ของ device |
| 1.3.6.1.2.1.1.5.0 |
sysName |
Hostname |
| 1.3.6.1.2.1.2.2.1.10 |
ifInOctets |
Interface input bytes (bandwidth in) |
| 1.3.6.1.2.1.2.2.1.16 |
ifOutOctets |
Interface output bytes (bandwidth out) |
| 1.3.6.1.2.1.2.2.1.8 |
ifOperStatus |
Interface operational status (up/down) |
| 1.3.6.1.4.1.9.9.109.1.1.1.1.6 |
cpmCPUTotal5minRev |
Cisco CPU utilization 5min |
SNMPv3 Security Levels
| Level |
Authentication |
Encryption |
Security |
| noAuthNoPriv |
Username only (no hash) |
ไม่มี |
ต่ำ (เหมือน v2c) |
| authNoPriv |
MD5 หรือ SHA (hashed) |
ไม่มี |
ปานกลาง |
| authPriv |
MD5 หรือ SHA (hashed) |
DES/AES (encrypted) |
สูง (recommended) |
SNMP Polling vs Traps
| Feature |
Polling (GET) |
Traps/Informs |
| Direction |
Manager → Agent (pull) |
Agent → Manager (push) |
| Timing |
Every X minutes (interval) |
เมื่อเกิด event (real-time) |
| Bandwidth |
สูงกว่า (poll ทุก interval) |
ต่ำ (ส่งเฉพาะ event) |
| Reliability |
สูง (manager control) |
Trap = unreliable (UDP), Inform = reliable (ack) |
| Use Case |
Performance monitoring (utilization, CPU) |
Event notification (link down, threshold) |
| Recommendation |
ใช้ทั้งสอง: poll สำหรับ metrics + traps สำหรับ events |
|
NMS Tools
| Tool |
Type |
จุดเด่น |
| Zabbix |
Open-source |
Full-featured NMS, SNMP + agent, templates |
| PRTG |
Commercial |
Easy setup, 100 sensors free, Windows |
| LibreNMS |
Open-source |
Auto-discovery, good SNMP support, community |
| Nagios/Icinga |
Open-source |
Alerting-focused, extensible plugins |
| SolarWinds NPM |
Commercial |
Enterprise leader, deep network features |
| Observium |
Open-source |
Auto-discovery, network-focused, clean UI |
| Datadog |
SaaS |
Cloud-native, infrastructure + APM |
Best Practices
| Practice |
รายละเอียด |
| ใช้ SNMPv3 authPriv |
Authentication + Encryption (SHA-256 + AES-256) |
| Restrict SNMP access |
ACL จำกัด source IP ที่ query ได้ |
| เปลี่ยน community strings |
อย่าใช้ “public”/”private” default |
| Read-only เป็นหลัก |
ใช้ RO community/user สำหรับ monitoring (ไม่ใช้ RW ถ้าไม่จำเป็น) |
| Poll interval |
5 min สำหรับ performance, 1 min สำหรับ critical interfaces |
| ใช้ 64-bit counters |
ifHCInOctets/ifHCOutOctets สำหรับ high-speed interfaces (>100 Mbps) |
| Monitor traps + polls |
Traps สำหรับ events + polling สำหรับ metrics |
ทิ้งท้าย: SNMP = Network Monitoring Foundation
SNMP = poll metrics + receive traps จาก network devices v2c = easy แต่ insecure, v3 = secure (authPriv recommended) OIDs = unique identifiers สำหรับ metrics (ifInOctets, CPU, etc.) Polling สำหรับ performance + Traps สำหรับ events ใช้ SNMPv3 + ACL + read-only + 64-bit counters
อ่านเพิ่มเติมเกี่ยวกับ NetFlow sFlow Analysis และ Network Troubleshooting ที่ siamlancard.com หรือจาก icafeforex.com และ siam2r.com