问题描述
我需要得到MAC的映射到IP存储DHCP服务器上,无论是通过程序的服务器本身或最好通过对DHCP客户端程序运行的程序运行。
I need to get the mapping of MAC to IP stored on DHCP server, either through a program running on the server itself or preferably through a program running on one of the DHCP clients.
据我了解可用于获取转储但是我没有太多的成功这一点。
I understand netsh utility can be used to get the dump however i have not had much success with that.
任何工作的例子上或在暗示?
Any working examples or hint on that?
我有DHCP服务器的管理权限
I have admin rights on DHCP server
修改
我不想使用ARP缓存因为这需要我或者广播ping(这是不允许在Windows上)或者ping所有子网可能的IP地址(这需要大量的时间)。
I dont want to use arp cache as that would require me to either broadcast ping (which is not allowed on windows) or ping the all possible ip address of subnet( which takes lot of time).
我相信,DHCP服务器存储MAC地址的映射IP,我怎么能使用这些信息,以地图MAC到IP地址的?
I am sure that DHCP server stores the mapping of MAC to IP, how can i use that information, to map MAC to IP address?
推荐答案
您可以使用 DHCP对象组件从 Windows 2000的资源工具包的这一点。尽管该组件是很难找到,为Windows 2000发,超出生命支持2010年7月,根据微软和具有非常小的文件,它的工作。
You can use the DHCP Objects component from the Windows 2000 Resource Kit for this. Even though the component is hard to find, is made for Windows 2000, goes out of life support in July 2010 according to Microsoft and has very little documentation, it does work.
- 从例如的如果你不能在微软找到它。这会给你这反过来将安装DHCP组件对象.exe文件。
- 注册
DHCPOBJS.DLL
文件,REGSVR32
的或的为它创建一个COM +应用程序。该标准适用取决于COM组件将如何在您的系统上使用。 - 使用类型库导入
tlbimp.exe是
创建一个围绕一个托管包装DHCPOBJS.DLL
现在,它的系统记录。 - 在Visual Studio中,添加到一个参考托管包装。它的默认生成的名称是
DhcpObjects.dll
。
- Download the Resource Kit Tool named DHCP Objects from for example here if you can't find it at Microsoft. This will give you an .exe file that in turn will install the DHCP Objects component.
- Register the
DHCPOBJS.DLL
file withregsvr32
or create a COM+ Application for it. Which is applicable depends on how the COM component is going to be used on your system. - Use the Type Library Importer
tlbimp.exe
to create a managed wrapper aroundDHCPOBJS.DLL
now that it's registered by the system. - In Visual Studio, add a reference to the managed wrapper. Its default generated name is
DhcpObjects.dll
.
现在您可以编写代码像这样对组件:
Now you can write code like this against the component:
using DhcpObjects;
class Program {
static void Main(string[] args) {
var manager = new Manager();
var server = dhcpmgr.Servers.Connect("1.2.3.4");
// query server here
}
}
安装程序还提供了包含关于如何查询和操作一台DHCP服务器更多的文件在Windows帮助文件。一节对象模型是非常有帮助的。
The installer also provides a Windows Help File which contains further documentation on how to query and manipulate a DHCP server. The section "The Object Model" is quite helpful.
这篇关于查询在C#中的DHCP服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!