Is IP on my Subnet?

  • Thread starter Thread starter Terry Olsen
  • Start date Start date
T

Terry Olsen

Is there an "elegant" way to determine if an IP address is on my subnet? Or
do I just compare the first 2 or 3 octets?
 
The elegant way is get both the subnet address and the IP address as 32-bit
unsigned integers, and AND them together. If the result equals the subnet,
it's on the subnet.

HTH,
Tom Dacon
 
Back
Top