How to judge whether two devices are in the same LAN?

I need to debug in a LAN environment, but there is only one wireless router + desktop (wired connection to the router) + development board (wireless connection to the router) at home, so I wonder if the desktop and the development board are in the same LAN?

1. Enter ipconfig on the desktop to obtain network information.

 

The ip address is: 192.168.10.2

The subnet mask is: 255.255.255.0

2. Since the development board is in a linux environment, you need to use ifconfig to obtain network information under the shell.

The ip address is: 192.168.10.3

The subnet mask is: 255.255.255.0

3. Conclusion

Whether it is the same LAN, you need to check whether the ip address & subnet mask are the same, if they are the same, they are in the same LAN, otherwise they are not in the same LAN.

4. By pinging the ip address

We can also ping the IP address of another device on one device, and if there is data transmission, it means that it is in the same LAN.

Guess you like

Origin blog.csdn.net/dreamDay2016_11_11/article/details/128422984