0

Is there any command similar to this code to print out the MAC address or "hash code" of the IP stored in this variable? I have done some research and it looks like it can be a really complex to impossible task. But I think it is worth a shot to ask. (Edit: Any IP I search is an internal IP to my Network).

            IPAddress addr = IPAddress.Parse(inputIP); //uses the input IP data into the addr variable to get host
            IPHostEntry entry = Dns.GetHostEntry(addr); //Get hostname
            Console.WriteLine("IP Address: " + addr);
            Console.WriteLine("Host Name: " + entry.HostName); //output logic
LeGreen95
  • 101
  • 10
  • 1
    You can't magically translate IP address to MAC address. For a local IP address you can query the ARP table but I'm not sure that's the case. – haim770 Apr 04 '17 at 18:05

1 Answers1

1

You can't get the MAC address of an ip which is not on your local network (i.e. the internet). For local IP/MAC addresses you can do an arp lookup.

This SO Post explains the arp lookup.

take
  • 2,202
  • 2
  • 19
  • 36
  • I forgot to add that they are all internal IP's, sorry about that. Thanks for the link, I will take a look at that. – LeGreen95 Apr 04 '17 at 18:06