通过SNMP协议获取linux信息,linux下的snmp配置及获取信息测试

1)配置snmp,编辑/etc/snmp/snmpd.conf

1.1)首选是定义一个共同体名(community),这里是public,及可以访问这个public的用户名(sec name),这里是notConfigUser。Public相当于用户notConfigUser的密码

1.2)定义一个组名(groupName)这里是notConfigGroup,及组的安全级别,把notConfigUser这个 用户加到这个组中。

1.3)定义一个可操作的范围(view)名, 这里是all,范围是 .1

1.4)定义notConfigUser这个组在all这个view范围内可做的操作,这时定义了notConfigUser组的成员可对.1这个范围做只读操作。

1.5)重启snmpd服务

1.6)列出snmpd开放端口

参考答案:

vi /etc/snmp/snmpd.conf

做如下修改:

#       sec.name source          community

com2sec notConfigUser default       public

#            groupName      securityModel securityName

group   notConfigGroup   v1           notConfigUser

group   notConfigGroup   v2c           notConfigUser

#       name           incl/excl     subtree         mask(optional)

view all             included     .1

#       group          context sec.model sec.level prefix read   write notif

access notConfigGroup ""      any       noauth    exact all none none

保存退出

service snmpd restart

netstat -anp|grep snmp

2.1)查看阅读mib-2所管理的信息类别的MIB文件

参考答案:

more /usr/share/snmp/mibs/RFC1213-MIB.txt

3)用snmpbulkwalk命令连接snmp服务器(192.168.6.53),获取snmp服务器的mib-2各种资讯

3.1)snmpbulkwalk用于通过SNMPv2 的SNMP GET BULK请求命令与其它网络实体通信,只能用于snmpv2,速度快于snmpwalk

3.2)指定共同体为public,协议为snmp2c

3.3)获取mib-2的system的数据,即.1.3.6.1.2.1.1(iso->identified organization->dod->internet->mgmt2->mib-2->system)

3.4)获取mib-2的interface的数据,即.1.3.6.1.2.1.2(iso->identified organization->dod->internet->mgmt2->mib-2->interface)

3.5)获取mib-2的address translation的数据,即.1.3.6.1.

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
linux环境下的snmp测试脚本, Installing SNMPv2C Agent Conformance Test Package 2008/04/08 IPv6 Promotion Council Terminology =========== Tester Node (TN) A tester node for the conformance tests. Node Under Test (NUT) A testee node for the conformance tests. Network Under Test The network where the conformance tests are executed. Tester Interface The network interface of TN hooked up to the Network Under Test. Interface Under Test The network interface of NUT hooked up to the Network Under Test. Prerequisites ============= Prerequisites for TN: - The package supports FreeBSD 6.0-RELEASE or higher version. - The package can also coexist with FreeBSD version of KAME. Installing the package onto TN ============================== 0. Before Starting (A) You need to install following softwares. - Perl (Required version : 5.8.7 or higher) - Net-SNMP (Required version : 5.3.1 or higher) *** You can download it from the following URL: http://net-snmp.sourceforge.net/ - v6eval (Required version : 3.0.11 or higher) Please refer to 00README.v6eval in "v6eval" for more information. *** You can download it from the following URL: http://www.tahi.org/release/ - koi (Required version : 1.1.1 or higher) Please refer to README file in "koi" package for more information. *** You can download it from the following URL: http://www.tahi.org/release/ 1. Extracting ct package % tar zxvf ct-snmpv2c-ag-X.X.tar.gz 2. Copying ct package Copy ct directory to any directory you like. % cp -pR $ORGDIR/ct-snmpv2c-ag-X.X $SOMEWHERE/ct-snmpv2c-ag-X.X % chmod -R +w $SOMEWHERE/ct-snmpv2c-ag-X.X 4. Setup ct environment % (enable TN's ipv6 capibility) % cd $SOMEWHERE/ct-snmpv2c-ag-X.X % edit config.txt % make test [End of INSTALL]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值