Get the network interface card (NIC) from a known MAC address (and get the IP addresses on that NIC)

/ Published in: C#
Save to your folder(s)

The code shows how to take a known MAC (e.g. "00:00:00:11:22:33") and locate the NIC which has that MAC. Note that the built-in MAC class for .NET is called PhysicalAddress (in System.Net.NetworkInformation). PhysicalAddress.Parse can take a string, so long as it has only numbers or numbers and dashes (-). We normally use colons (:) instead of dashes, so that's why I do a .Replace().

The last part of the code retrieves the IP Addresses associated with the selected NIC.

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.