網上雖然有很多這方面的資料,不過都很亂,感覺說的也不太好,所以我總結了一下,我在windows 7上可以成功配置好
1. 下載安裝
net-snmp安裝程式:net-snmp-5.4.2.1-1.win32.exe
Perl安裝程式:ActivePerl-5.10.0.1004-MSWin32-x86-287188.msi
安裝過程預設就好
2.配置snmpd.conf檔案
在路徑(軟體安裝路徑)\etc\snmp\下,添加檔案snmpd.conf,注意去掉.txt尾碼,另外此路徑下已經有了一個snmp.conf檔案,不要混亂兩者,
然後一下兩種方式二選一:
a.簡單配置:在snmpd.conf加入:rocommunity public
b.詳細配置:在snmpd.conf加入:
####
# First, map the community name (COMMUNITY) into a security name
# (local and mynetwork, depending on where the request is coming
# from):
# sec.name source community
com2sec local localhost root
com2sec local 192.168.1.110 root
com2sec mynetwork 192.168.1.0/24 public
####
# Second, map the security names into group names:
# sec.model sec.name
group MyRWGroup v1 local
group MyRWGroup v2c local
group MyRWGroup usm local
group MyROGroup v1 mynetwork
group MyROGroup v2c mynetwork
group MyROGroup usm mynetwork
####
# Third, create a view for us to let the groups have rights to:
# incl/excl subtree mask
view all included .1 80
####
# Finally, grant the 2 groups access to the 1 view with different
# write permissions:
# context sec.model sec.level match read write notif
access MyROGroup "" any noauth exact all none none
access MyRWGroup "" any noauth exact all all none
####
(注意每次改動snmpd.conf檔案後都要重啟snmp服務)
3.註冊snmp agent服務,在(軟體安裝路徑)\路徑下,開啟檔案registeragent.bat就行,自動註冊服務
4.然後重新啟動snmp
>net stop "net-snmp agent"
>net start "net-snmp agent"
5.OK,可以使用了,測試一下吧:
>snmpwalk -v 2c -c root localhost if
>snmpwalk -v 2c -c root 192.168.1.110 if
>snmpget -v 2c -c root localhost 1.3.6.1.2.1.1.1.0