手動配置 SNMP 服務繁瑣且易出錯,利用 sysocmgr.exe 搭配 INF 回應檔可實現全自動化部署,適合大量伺服器環境。
snmp.inf 回應檔[NetOptionalComponents]
SNMP = 1
[SNMP]
Contact_Name = "ITSupport"
Location = "ServerRoom"
Service = Physical, Applications, End-to-End
Community_Name = "YourCommunityString"
Traps = "192.168.1.100"
Send_Authentication = Yes
Accept_CommunityName = "YourCommunityString:Read_Only"
Any_Host = no
Limit_Host = "192.168.1.100"
關鍵參數說明:
Community_Name:讀寫社群名稱,請務必修改預設 publicTraps / Limit_Host:管理主機 IP,限制僅接受來自該 IP 的 SNMP 請求與 Trap 發送Accept_CommunityName:格式 社群名:權限,Read_Only 僅允許讀取C:\Windows\System32\sysocmgr.exe /i:%windir%\inf\sysoc.inf /u:path_to_the_file\snmp.inf
/i 指定系統元件安裝 INF/u 指定自訂回應檔路徑SNMP Service 狀態為「已啟動」且啟動類型為「自動」snmpwalk -v 2c -c YourCommunityString localhost 測試本機查詢snmpwalk -v 2c -c YourCommunityString 目標IP 驗證網路通訊HKLM\SYSTEM\CurrentControlSet\Services\SNMP\Parameters 後重啟服務Send_Authentication = Yes 記錄驗證失敗事件