网络管理人员应该掌握这个小工具,命令虽简单,但在交换机、路由器监控上有可以起到不小作用。在企业内,很多管理员都可能会被这样一个问题困扰:企业内部员工有不同的网络权限,有些可以上外网,有些不能上外网。这样有些员会私自更改IP,网络管理员很难立即去发现这个问题,只有等到有员工报IP冲突故障时才发现有人盗用IP,然后管理才开始去查谁谁盗用了这个IP,可能有些管理人员还查不出来是谁盗用了这个IP,没法了,只有把这个IP权限改了

snmpwalk 可以有效解决这个问题

方法:

1:在企业内部核心交换机上,开启SNMP功能

2:找到交换机的一个特殊OID号,默认是1.3.6.1.4.1.2011.5.25.123.1.12

3:读取IP对应的MAC

4:实例:/usr/bin/snmpwalk -v 2c -c 'xxxxx' 192.168.1.1

1.3.6.1.4.1.2011.5.25.123.1.12

snmpwalk :手册

snmpwalk - retrieve a subtree of management values using SNMP GETNEXT requests

SYNOPSIS

snmpwalk [APPLICATION OPTIONS] [COMMON OPTIONS] [OID]

DESCRIPTION

snmpwalk  is an SNMP application that uses SNMP GETNEXT requests to query a network entity for a tree of infor-

mation.

An object identifier (OID) may be given on the command line.  This OID specifies which portion  of  the  object

identifier space will be searched using GETNEXT requests.  All variables in the subtree below the given OID are

queried and their values presented to the user.  Each variable name is given in the format specified  in  vari-

ables(5).

If  no OID argument is present, snmpwalk will search the subtree rooted at SNMPv2-SMI::mib-2 (including any MIB

object values from other MIB modules, that are defined as lying within this subtree).  If  the  network  entity

has an error processing the request packet, an error packet will be returned and a message will be shown, help-

ing to pinpoint why the request was malformed.

If the tree search causes attempts to search beyond the end of the MIB, the message "End of MIB" will  be  dis-

played.

OPTIONS

-Cc     Do  not  check whether the returned OIDs are increasing.  Some agents (LaserJets are an example) return

OIDs out of order, but can complete the walk anyway.  Other agents return OIDs that are  out  of  order

and  can  cause  snmpwalk to loop indefinitely.  By default, snmpwalk tries to detect this behavior and

warns you when it hits an agent acting illegally.  Use -Cc to turn off this check.

-CE {OID}

End the walk at the specified OID, rather than a simple subtree.  This can be used to  walk  a  partial

subtree, selected columns of a table, or even two or more tables within a single command.

-Ci     Include  the  given OID in the search range.  Normally snmpwalk uses GETNEXT requests starting with the

OID you specified and returns all results in the MIB subtree rooted at that OID.   Sometimes,  you  may

wish  to  include  the OID specified on the command line in the printed results if it is a valid OID in

the tree itself.  This option lets you do this explicitly.

-CI     In fact, the given OID will be retrieved automatically if the main subtree walk returns no useable val-

ues.  This allows a walk of a single instance to behave as generally expected, and return the specified

instance value.  This option turns off this final GET request, so a walk  of  a  single  instance  will

return nothing.

-Cp     Upon completion of the walk, print the number of variables found.

-Ct     Upon  completion of the walk, print the total wall-clock time it took to collect the data (in seconds).

Note that the timer is started just before the beginning of the data request series  and  stopped  just

after  it finishes.  Most importantly, this means that it does not include snmp library initialization,

shutdown, argument processing, and any other overhead.

In addition to these options, snmpwalk takes the common options described in the snmpcmd(1) manual page.

EXAMPLES

The command:

snmpwalk -Os -c public -v 1 zeus system

will retrieve all of the variables under system:

sysDescr.0 = STRING: "SunOS zeus.net.cmu.edu 4.1.3_U1 1 sun4m"

sysObjectID.0 = OID: enterprises.hp.nm.hpsystem.10.1.1

sysUpTime.0 = Timeticks: (155274552) 17 days, 23:19:05

sysContact.0 = STRING: ""

sysName.0 = STRING: "zeus.net.cmu.edu"

sysLocation.0 = STRING: ""

sysServices.0 = INTEGER: 72

(plus the contents of the sysORTable).

The command:

snmpwalk -Os -c public -v 1 -CE sysORTable zeus system

will retrieve the scalar values, but omit the sysORTable.

SEE ALSO

snmpcmd(1), snmpbulkwalk(1), variables(5).

4th Berkeley Distribution         08 Feb 2002                      SNMPWALK(1)

转载于:https://blog.51cto.com/1277594/1110985

snmpwalk 小工具相关推荐

  1. 分享一个小工具:Excel表高速转换成JSON字符串

    在游戏项目中一般都须要由策划制作大量的游戏内容,当中非常大一部分是使用Excel表来制作的.于是程序就须要把Excel文件转换成程序方便读取的格式. 之前项目使用的Excel表导入工具都是通过Offi ...

  2. 代码整理工具_程序员软件:程序员有哪些常用又好用的编码小工具?

    最近,有很多朋友让我帮忙整理一下程序员有哪些常用又好用的编码小工具.今天,小编就整理一下哦,希望大家一起学习,一起进步! 1. Notepad++ Notepad++中文版是一款非常有特色的编辑器,是 ...

  3. python自动翻译小工具_Python实现翻译小工具

    一.背景 利用Requests模块获取有道词典web页面的post信息,BeautifulSoup来获取需要的内容,通过tkinter模块生成gui界面. 二.代码 git源码地址 Python实现翻 ...

  4. 实用c语言函数源码,C语言编写简单朗读小工具(有源码)

    原标题:C语言编写简单朗读小工具(有源码) 最近不少人在后台留言说学C都是面对枯燥的控制台程序,能不能体现一下C语言的实际用途,今天我们就理论结合实践一把:C语言结合VBS脚本编写一个简单的朗读小工具 ...

  5. 【青少年编程】黄羽恒:翻译小工具 -- 利用百度翻译

    「青少年编程竞赛交流群」已成立(适合6至18周岁的青少年),公众号后台回复[Scratch]或[Python],即可进入.如果加入了之前的社群不需要重复加入. 微信后台回复"资料下载&quo ...

  6. 【青少年编程】黄羽恒:翻译小工具 -- 利用有道翻译

    「青少年编程竞赛交流群」已成立(适合6至18周岁的青少年),公众号后台回复[Scratch]或[Python],即可进入.如果加入了之前的社群不需要重复加入. 微信后台回复"资料下载&quo ...

  7. 太强了,Python 开发桌面小工具,让代码替我们干重复的工作~

    作者 | Cherish 来源 | 杰哥的IT之旅 决定写这篇文章的初衷是来源于一位小伙伴的问题,关于"如何根据数据源用 Python 自动生成透视表",这个问题背后有个非常好的解 ...

  8. 把python语言翻译出来_Python语言实现翻译小工具(Python打包成exe文件)

    本文主要向大家介绍了Python语言实现翻译小工具(Python打包成exe文件),通过具体的内容向大家展示,希望对大家学习Python语言有所帮助. 1.环境 windows10 python3.5 ...

  9. 某程序员为方便老婆工作,写了一些小工具给老婆用!如今老婆要离职,公司老板却要求必须把工具留下!网友:跟他收费!...

    请点击上面 一键关注! 最近一个程序员发帖说了这么一件有意思的事: 老婆是一个小公司的hr兼行政,工作繁琐,为了支持老婆工作,这个程序员就写了一些小工具给老婆用,包括工牌生成器.日报格式化工具.年会抽 ...

最新文章

  1. 非常好的bert中文预训练资料
  2. 使用jena 进行RDF推理
  3. 导入BaiduMapSdkDemo报230错误解决思路
  4. 福利再度来袭,R语言数据分析书籍值得你拥有
  5. Angularjs总结(五)指令运用及常用控件的赋值操作
  6. (十二)nodejs循序渐进-高性能游戏服务器框架pomelo之创建一个游戏聊天服务器
  7. markdown改字体和背景颜色(html)
  8. JS编程建议——32:使用制表
  9. php安装包解压后,ps下载后怎么解压安装
  10. 3月4日见!Redmi Note 10系列屏幕升级:首次采用Super AMOLED屏
  11. 感恩节活动促销海报模板,摆好借势感恩节的姿势
  12. gc:C语言的垃圾回收库-中文
  13. 闪耀在UNIX传奇往事中的启示,UNIX见证者带你一览究竟
  14. 【已解决】微信小程序web-view嵌套H5,使用setStorageSync,localStorage.setItem有时候失效的问题
  15. object与reflect
  16. 智能商场管理系统(可当做毕设)
  17. 传统蓝牙HCI(Bluetooth HCI)的概念介绍
  18. shell 开机自动执行_【自研】开机自动登陆佛大校园网程序安装全教程
  19. spring mvc 附件上传至腾讯云qcloud
  20. 【数据结构】树Tree

热门文章

  1. Docker动荡在继续:创始人兼CTO离职
  2. 怎样三天训练出AI围棋大师?教你AlphaGo Zero的3个trick
  3. 清华成北京赛赢家,旷视唐文斌分享本质创业 | 联想高校AI精英挑战赛
  4. Java提高班(二)深入理解线程池ThreadPool
  5. JQuery的click、bind、delegate、off、unbind
  6. redis的数据持久化方案
  7. 关于简历的一点心得(纯属个人想法,非专业人士,欢迎批评指正~)
  8. Android之Handler
  9. 检查java程序假死的脚本
  10. CVTE前端笔试20190302