I am writing a java application which has to be able to turn on (WOL which is workin fine) and shut down a pc on the local network. The thing is I want it to be able to do both while only providing the MAC-address. What I need is a way to get the ip-address of a pc (if powered on) by providing only its MAC-address. I see a lot of thread about doing the opposite but this seemed like a dead end.

Thanks in advance Krolden

有帮助吗?

解决方案

This isn't possible in the general case; IP addresses and MAC addresses have a many-to-many relationship (most interfaces have multiple IP addresses, and a single IP address can be bound to multiple MACs, though this latter is usually in a load-balancing scenario).

The InARP protocol is available on Frame Relay, but is not applicable to Ethernet.

The closest you can get--and this is unreliable for a number of reasons--is to broadcast ping the subnet the target computer is on after giving it time to wake up. You can then inspect the ARP cache on the local computer to find a matching entry.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top