QNAP School > FAQ > Network
How to determine if two network devices are in the same LAN?

Applied Models:

  • ICS-1013
  • NVR-101
  • NVR-1012
  • NVR-104P
  • NVR-104V
  • VioCard-100
  • VioCard-300
  • VioGate Master
  • VioGate-140
  • VioGate-340(340A)
  • Vioserver-10
  • Vioserver-5
  • VioStor-101A
  • VioStor-101P
  • VioStor-101V
  • VioStor-2008
  • VioStor-2012
  • VioStor-201A
  • VioStor-201P
  • VioStor-201V
  • VioStor-5012
  • VioStor-5020
  • VioStor-8040
  • VioStor-8040U-RP

Answer:

Example 1.

Assume that there is a PC A with IP: 192.168.1.10 and subnet mask: 255.255.255.0.  PC A wants to connect PC B with IP: 192.123.2.3.  Multiply IP of PC A by the 4 digits of subnet mask A (convert 255 as 1).  Then multiply the 4 digits of PC B’s IP by the 4 digits of PC A’s subnet mask (convert 255 as 1).  If the sum is the same, they are in the same LAN.  If not, they aren’t.

IP (PC A): 192.168.1.10 <--192.168.1.10
Subnet mask (PC A): 255.255.255.0 <--1.1.1.0
Result: 192.168.1.0

IP (PC B): 192.123.2.3 <--192.123.2.3
Subnet mask (PC A): 255.255.255.0 <--1.1.1.0
Result: 192.123.2.0

As 192.168.1.0 192.124.2.0, PC A and PC B are not in the same LAN.

Example 2.

PC A with IP: 192.168.1.10 and subnet mask: 255.255.255.0; PC B with IP 192.168.1.39.
IP (PC A): 192.168.1.10 <-- 192.168.1.10
SM (PC A): 255.255.255.0 <-- 1.1.1.0
Result: 192.168.1.0

IP (PC B): 192.168.1.39 <-- 192.168.1.39
SM (PC A): 255.255.255.0 <-- 1.1.1.0
Result: 192.168.1.0

As 192.168.1.0=192.168.1.0, PC A and PC B are in the same LAN.

2009/06/19
Back