
SNMP v3: Monitor Network Devices อย่างปลอดภัย
SNMP (Simple Network Management Protocol) เป็น protocol มาตรฐานสำหรับ monitor และ manage network devices (switches, routers, firewalls, servers) SNMP v3 เป็นเวอร์ชันล่าสุดที่เพิ่ม authentication และ encryption ทำให้ปลอดภัยกว่า v1/v2c ที่ส่ง community string เป็น plaintext
หลายองค์กรยังใช้ SNMP v2c ที่ community string (เช่น “public”, “private”) ส่งเป็น plaintext ทำให้ attacker ดักจับได้ง่าย แล้วใช้ write community เปลี่ยน config ของ network devices ได้ SNMP v3 แก้ปัญหานี้ด้วย authentication (MD5/SHA) และ encryption (DES/AES) บทความนี้จะอธิบายวิธี deploy SNMP v3 อย่างปลอดภัย
SNMP Versions
| Version | Authentication | Encryption | Security | สถานะ |
|---|---|---|---|---|
| SNMPv1 | Community string (plaintext) | ไม่มี | ต่ำมาก | ไม่แนะนำ |
| SNMPv2c | Community string (plaintext) | ไม่มี | ต่ำ | ยังใช้กันมาก แต่ไม่แนะนำ |
| SNMPv3 noAuthNoPriv | Username only | ไม่มี | ต่ำ | ไม่แนะนำ |
| SNMPv3 authNoPriv | MD5/SHA | ไม่มี | ปานกลาง | ใช้ได้ถ้าอยู่ใน trusted network |
| SNMPv3 authPriv | SHA-256/SHA-512 | AES-128/256 | สูง | แนะนำ |
SNMP Components
Architecture
SNMP Manager (NMS): ระบบ monitoring ที่เก็บข้อมูลจาก devices เช่น Zabbix, PRTG, LibreNMS, SolarWinds SNMP Agent: Software บน network device ที่ตอบ SNMP queries MIB (Management Information Base): โครงสร้างข้อมูลที่กำหนดว่า device มีข้อมูลอะไรให้ query OID (Object Identifier): ID เฉพาะของแต่ละ data point เช่น 1.3.6.1.2.1.1.1.0 = sysDescr
SNMP Operations
| Operation | ทิศทาง | ใช้ทำอะไร |
|---|---|---|
| GET | Manager → Agent | ขอค่า OID เฉพาะ (เช่น CPU usage) |
| GET-NEXT | Manager → Agent | ขอค่า OID ถัดไป (walk through MIB) |
| GET-BULK | Manager → Agent | ขอหลาย OIDs พร้อมกัน (v2c/v3) |
| SET | Manager → Agent | เปลี่ยนค่าบน device (เช่น shutdown interface) |
| TRAP | Agent → Manager | แจ้งเตือนเมื่อเกิดเหตุการณ์ (link down, high CPU) |
| INFORM | Agent → Manager | เหมือน TRAP แต่มี acknowledgment (reliable) |
SNMPv3 Configuration
Cisco IOS
สร้าง SNMPv3 Group + User: snmp-server group MONITOR-GROUP v3 priv read MONITOR-VIEW snmp-server user monitor-user MONITOR-GROUP v3 auth sha MyAuthPass123! priv aes 128 MyPrivPass456!
กำหนด View (จำกัด OIDs ที่เข้าถึงได้): snmp-server view MONITOR-VIEW iso included snmp-server view MONITOR-VIEW internet included
จำกัด source IP: snmp-server group MONITOR-GROUP v3 priv read MONITOR-VIEW access SNMP-ACL ip access-list standard SNMP-ACL permit 10.0.20.0 0.0.0.255
SNMP Trap destination (v3): snmp-server host 10.0.20.50 version 3 priv monitor-user snmp-server enable traps
Useful OIDs
| OID | ชื่อ | ข้อมูล |
|---|---|---|
| 1.3.6.1.2.1.1.1.0 | sysDescr | Device description (model, OS version) |
| 1.3.6.1.2.1.1.3.0 | sysUpTime | Uptime ของ device |
| 1.3.6.1.2.1.2.2.1.10 | ifInOctets | Bytes received per interface |
| 1.3.6.1.2.1.2.2.1.16 | ifOutOctets | Bytes sent per interface |
| 1.3.6.1.2.1.2.2.1.8 | ifOperStatus | Interface status (up/down) |
| 1.3.6.1.4.1.9.9.109.1.1.1.1.6 | cpmCPUTotal5minRev | CPU usage 5 min (Cisco) |
| 1.3.6.1.4.1.9.9.48.1.1.1.5 | ciscoMemoryPoolUsed | Memory used (Cisco) |
NMS Tools
| Tool | ประเภท | จุดเด่น |
|---|---|---|
| Zabbix | Open-source | Flexible, SNMPv3 support, alerting |
| LibreNMS | Open-source | Auto-discovery, network-focused |
| PRTG | Commercial | Easy setup, 100 sensors free |
| SolarWinds NPM | Commercial | Enterprise-grade, deep analytics |
| Observium | Open-source | Network-focused, auto-discovery |
Security Best Practices
| Practice | ทำไม |
|---|---|
| ใช้ SNMPv3 authPriv เท่านั้น | Authentication + Encryption ป้องกัน sniffing |
| ปิด SNMPv1/v2c | Community string เป็น plaintext |
| จำกัด source IP ด้วย ACL | เฉพาะ NMS server เท่านั้นที่ query ได้ |
| ใช้ SHA-256+ สำหรับ authentication | MD5 ไม่ปลอดภัยแล้ว |
| ใช้ AES-128+ สำหรับ encryption | DES ไม่ปลอดภัยแล้ว |
| ใช้ View จำกัด OIDs | Read-only เฉพาะที่จำเป็น ไม่ให้ SET access |
| เปลี่ยน password สม่ำเสมอ | ลดความเสี่ยงจาก credential leak |
ทิ้งท้าย: ย้ายจาก SNMPv2c เป็น v3 เดี๋ยวนี้
SNMPv3 ให้ authentication + encryption ที่ v1/v2c ไม่มี ย้ายจาก v2c เป็น v3 ไม่ยาก configure user + group + view บน devices แล้ว update NMS ให้ใช้ v3 ปิด v1/v2c เมื่อย้ายเสร็จ จำกัด SNMP access ด้วย ACL
อ่านเพิ่มเติมเกี่ยวกับ Network Monitoring Grafana Prometheus และ Network Automation Ansible ที่ siamlancard.com หรือจาก icafeforex.com และ siam2r.com