Windows 下安装 net-snmp 代理详解
Net-SNMP 是一个流行的 SNMP 代理软件,它可以在多种操作系统上运行,包括 Windows。在本文中,我们将详细介绍如何在 Windows 下安装和配置 Net-SNMP 代理。
安装 Net-SNMP
需要下载 Net-SNMP 的安装程序,网址为 。选择适合的版本,例如 net-snmp-5.7.0-1.x86.exe,然后选择 Windows external DLL 扩展支持。安装过程中,保持所有默认设置即可。
配置 snmpd.conf 文件
安装完成后,需要配置 snmpd.conf 文件,该文件位于软件安装路径的 etc\snmp 目录下。需要创建一个名为 snmpd.conf 的文件,不要与已经存在的 snmp.conf 文件混淆。
在 snmpd.conf 文件中,可以选择两种配置方式:简单配置和详细配置。
简单配置
在 snmpd.conf 文件中添加以下内容:
```
rocommunity public
```
详细配置
在 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
```
注册 SNMP 代理服务
在软件安装路径下,打开文件 registeragent.bat,自动注册服务。
启动 SNMP 代理服务
在命令行中输入以下命令:
```
net stop "net-snmp agent"
net start "net-snmp agent"
```
测试 SNMP 代理
使用以下命令测试 SNMP 代理:
```
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
```
至此,我们已经成功安装和配置了 Net-SNMP 代理在 Windows 下。
2026-05-25 23:12:02
279KB
1