How to tell if two IPs are on the same subnet?
871946Jun 28 2011 — edited Jun 28 2011Hi,
By a given target host IP, I am working on matching a local IP address in order to appropriately subscribe CIM indication to the target host.
In a way, I need to iterate through all the local IP addresses to match the given IP of the endpoint. The method java.net.InetAddress.isReachable() does not return the reliable. I am thinking to use subnet mask to match the IPs. Any suggestions? Hope both IPv4 and IPv6 can be handled.
Thank you.