Question:
How do I determine if two network devices are in the same LAN?
Answer:
Example 1.
Assume that there is a PC 'A' with IP Address: 192.168.1.10 and subnet mask: 255.255.255.0.
PC 'A' wants to connect to PC 'B' with IP Address: 192.123.2.3.
Multiply the IP Address of PC 'A' by the 4 digits of subnet mask 'A' (convert 255 as 1).
Then multiply the 4 digits of PC 'B' IP Address by the 4 digits of PC 'A' subnet mask (convert 255 as 1).
If the sum is the same, they are in the same LAN. If not, they aren’t.
IP Address (PC A): 192.168.1.10
Subnet mask (PC A): 255.255.255.0 use 1.1.1.0 as multiplier
Result: 192.168.1.0 (1 x 192, 1 x 168, 1 x 1, 0 x 10)
IP Address (PC B): 192.123.2.3
Subnet mask (PC A): 255.255.255.0 use 1.1.1.0 as multiplier
Result: 192.123.2.0 (1 x 192, 1 x 123, 1 x 2, 0 x 3)
Since 192.168.1.0 and 192.123.2.0 are not equal, PC 'A' and PC 'B' are not in the same LAN.
Example 2.
PC A with IP Address: 192.168.1.10 and subnet mask: 255.255.255.0; PC B with IP Address 192.168.1.39.
IP Address (PC A): 192.168.1.10
Subnet Mask (PC A): 255.255.255.0 use 1.1.1.0 as multiplier
Result: 192.168.1.0
IP Address (PC B): 192.168.1.39
Subnet Mask (PC A): 255.255.255.0 use 1.1.1.0 as multiplier
Result: 192.168.1.0
Since 192.168.1.0 is equal 192.168.1.0, PC 'A' and PC 'B' are in the same LAN.
Comments