Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 8244 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

I am making a calculation that compares IP addresses to see if they are the same. That is easy enough, but I also want to check to see if they are on the same sub net. for example:

55.56.57.56

55.56.57.69

are not the same IP but they are on the same subnet, because the first 3 numbers on the same but the last is different.

But each of the numbers can be 1 to 3 digits and can't just compare the left X numbers, i just want to see if the first 3 are the same.

How would your left brain do that?

Posted

You need to treat the IP address as a text string. This test will return a 1 if the subnets match (1.2.3.x = 1.2.3.y)

Left(IP1, Position(IP1, ".", 1, 3) - 1) = Left(IP1, Position(IP2, ".", 1, 3) - 1)

-bd

Posted

Be careful. The first 3 numbers do not necessarily specify the subnet. You need to check the subnet mask. If it's 255.255.255.0 then fine, but this isn't always the case in large organizations with large networks.

This topic is 8244 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.