September 22, 2023

How to determine if two different IP addresses are on same network segment

We know that an IP address consists of "network number + subnet number + host number". Judging whether two IP addresses are on same network segment mainly depends on "network number". If network number is same, then they are in same network segment Network segment, otherwise not in network segment.

There are three addresses below, let's set PC address and subnet mask first, and then check:



Two addresses can communicate with each other, indicating that they are on same network segment;



These two addresses can also interact with each other, indicating that these two addresses are also on same network segment;



The two addresses cannot communicate with each other, which means they are not on same network segment.

Why, let's count together and see what their network numbers are?

You can see there is only a third group, their network numbers are different so they are not in same address segment.

The network number of an IP address is calculated by ANDing the IP address and mask.

Welcome and if you need a topology map, follow me + private message me, let's explore smart technologies together!