SNMP OID可以将MAC地址映射到IP地址吗? [英] SNMP OID to map MAC addresses to ip addresses?
问题描述
我编写了一些C#代码,用于运行文件"snmpwalker.exe",当我使用OID传递正确的社区字符串ip地址和vlan信息时,该信息返回有关cisco交换机的详细信息.我已经能够获得足够的信息,以便能够将MAC地址映射到交换机的端口,但是我也想找出IP地址.有谁知道snmp的OID是什么,以便在cisco交换机上取回包含mac地址和ip地址的列表?
I have written some C# code that I am using to run an file "snmpwalker.exe" that is returning details about so cisco switches when I pass in the correct community string ip address and vlan information with an OID. I have been able to get enough information to be able to map the MAC addresses to the switch's ports but I want to also find out the ip addresses. Does anyone know what the OID for snmp would be to get back a list with mac addresses and ip addresses on a cisco switch?
我以前从未使用过snmp或在网络方面做过很多工作,所以我对这些东西的大部分工作方式还是陌生的.
I haven't used snmp before or done much in networking so I am new to how most of this stuff works.
推荐答案
交换机是第2层设备.它与MAC地址一起使用,对IP地址一无所知.
A switch is a layer-2 device. It works with MAC addresses and knows nothing about IP addresses.
DHCP服务器将仅具有请求IP地址的设备的MAC地址.服务器,交换机,打印机等可能不会使用DHCP.
A DHCP server will only have MAC addresses for devices that have requested an IP address. Servers, switches, printers etc. probably won't use DHCP.
其他想法:
- 如果您的子网很小,则可以ping通每个地址并查看主机中的ARP缓存.这应该找到大多数具有IP地址的内容,但并非所有内容都必须响应PING.对于大型子网,这会很慢,而且不是很好的做法.
- 您可以ping多播所有主机地址(224.0.0.1)并检查ARP缓存,但这只会找到具有多播功能的设备.
- Ping子网广播地址并检查ARP缓存.同样,并非所有事情都一定会做出回应.
结合使用这些方法可能会获得大多数好处,但是您将很难找到例如静态地址无法响应ping的打印机.
Combining these approaches will probably get most things, but you'll have trouble finding, for example, a printer with a static address that doesn't respond to ping.
如果您不理解这些术语,请先查找有关网络的教程.
If you don't understand these terms find a tutorial on networking before you go any further.
这篇关于SNMP OID可以将MAC地址映射到IP地址吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!