Query a DHCP server for a specified IP Addres to obtain MAC and hostname

Nov 19 2009 6:03 PM
I have searched several forums and found various flavors of my issue. However, I can't seem to get good resolution. So here's the problem:

I am writing an app that collects IP Accounting data from Cisco Routers. The app collects only the Source, Destination, bytes, and packets. All of this information is stored in a SQL database.

The output of the IPA data is timed (Cisco cron jobs). My IPAHandler needs to be able to resolve IP Addresses to host names. I am doing this with some releative ease, until it comes to local IP Addresses of machines that are not joined to the domain.

We are a college and we have several "rogue" notebooks on wireless. We would like to be able to capture the machine name of each device that gets an IP address - subsequently we would have their network usage data. But if I try to use the code listed below I get an error:
===========
string sName = Dns.GetHostEntry(IP).HostName;
===========

Our AD only allows secure updates, so they don't show up in DNS and I get the following exception:
===========
No such host is known.
===========

Here's the question:

Can I query the DHCP server (an AD Domain Controller) for the IP Address and machine name? If so, do I need to use a WMI query, or is there an API I can use?


Answers (2)