Is IP on my Subnet?

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?
 
T

Tom Dacon

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

At a loss figuring out if an IP is on LAN or INET 20
Static IP on a printer fails 6
Check if an IP address is in a range. 3
IP Subnet Test 1
Subnet issue 1
Focus issue 7
Calculate IP subnet 1
Validate IP Address 16

Top