0

If you have multiple members in a household using each their own PCs, some connected wirelessly, some via LAN cable - How can you check if all those PCs are all in the same subnet or broadcast domain?

Please advise step by step how to check it on both systems Linux and Windows? Any straight forward command line available?

To clarify: By LAN I mean a PC connected via wired LAN Cable to the Router. By WIFI I mean a wireless connected PC.

Thanks

3
  • Are your wireless and wired devices connected to the same router?
    – Sam Forbis
    Commented May 21, 2020 at 14:33
  • @SamForbis this shouldn't matter to the answer, WiFi presents as Ethernet packets to the router (once WiFi overheads are removed) and WiFi and Ethernet devices can - and typically are bridged into the same subnetwork.
    – davidgo
    Commented May 21, 2020 at 19:32
  • @davidgo I'm aware, I was just thinking of reasons why someone would ask a question like this. Obviously, if they are on the same router (especially a consumer router), they will be on the same subnet. I was thinking this OP may be in a situation where they may have multiple routers set up.
    – Sam Forbis
    Commented May 21, 2020 at 19:36

2 Answers 2

2

You need to know subnet mask and IPv4 adress of each PC.
Open a command/terminal prompt. Type:
ipconfig for Windows
ifconfig for Linux.
Press ENTER.

Look at the subnet mask. Does it match?
NO: You know right away computers are not on the same network.
YES: Proceed below to determine whether or not computers are on the same subnet.

Compare IP addresses to determine if devices are on the same subnet.

We will be using most common subnet mask of 255.255.255.0 as example. It tells us the size of the network block:

  • In each of the four sections, if the value is 255, we will substitute that with a 0.
  • If there is any other number in the section, we then subtract that number from 256.
  • In the example above, we would get 0.0.0.256 (256 - 0 = 256). This is a block of 256 numbers.

If the subnet were 255.255.252.0, we substitute and get 0.0.4.256. This is a block of 1024 addresses (4 x 256 = 1024).

When comparing two IP address/subnet combinations, the addresses must match for any section where the subnet value is 255. For a subnet of 255.255.255.0, we expect to see the first three sections of the IP address match (reading left to right) if they are in the same subnet.

The key is to match up the subnet and the IP address. Let’s look at four examples: enter image description here

7
  • thx. And do you also know how to make it that wired connected PCs are NOT in the same subnet as the wirelessly connected PCs? How could one achieve that, with what settings @bald-eagle? Commented May 21, 2020 at 17:42
  • Go to network settings and set local IPs and masks. As example, you can set mask 255.255.255.0 everywhere, 192.168.1.xxx for wired and 192.168.0.xxx for wirless PCs. @ threeeMiaNichole
    – Bald Eagle
    Commented May 21, 2020 at 17:47
  • To open network config at win10 press Win+R. Command "control.exe /name Microsoft.NetworkandSharingCenter" and Enter. Then click "change adapter settings". There right click on the LAN or wi-fi network, select "Properties". Left click on TCH/IPv4, click properties. There you can set up required parameters. Instructions for linux: library.netapp.com/ecmdocs/ECMP1155586/html/…
    – Bald Eagle
    Commented May 21, 2020 at 17:57
  • last two clarifications please: (1) If all the wired and wirelessly connected PCs would use a VPN, would they still be in same subnet? Or is a VPN somehow hindering them to be in the same broadcast domain @bald-eagle?.. (2) when you say "go to network settings and set local IPs and masks..." - how do I navigate to the network settings that apply for wired LAN, and the settings that apply for wireless WLAN? Commented May 21, 2020 at 18:07
  • (1) VPN does not change your actual IP, so your local network will not be affected. (2) for linux, in ifconfig output "link encap" parameter and/or "flags" should indicate type of connection for particular interface_name. This is how "change adapter settings" window looks: help.keenetic.com/hc/article_attachments/360001400240/…
    – Bald Eagle
    Commented May 21, 2020 at 18:39
1

There is a way then @BaldEagle answer if you don't want to do math or worry about netmasks. This way is more reliable as it can work even if you have 2 isolated networks both with same the ip range ( eg an office with 2 internet connections, 2 routers both set up with the default 192.168.1.1/24 and doing NAT).

Establish the IP address of system 1. Have the a system 1 ping another system 2 and while (or shortly after) this ping is in process on system 2 in a terminal or command window type "arp -an" If the IP address on system 1 appears in the list of entries its on the same subnet (and this will be true even if ping fails to respond).

I have assumed here that devices only have 1 route to see each other. (Ie things might break down in cases where a device has an Ethernet and WiFi connection - in this case you need to know the iIP address of the interface sendingvthe ping - typically the LAN one).

The idea here is that (for systems calculated by system 1 as being in the broadcast domain - which is done at a technical level as per BaldEagle answer) will send a broadcast packet "who has IP address X" - and the appropriate machine will respond "me, here us my MAC address", and IP and the systems can then communicate directly. The ARP command shows the table of remembered addresses.

12
  • thanks and can you just tell, @davidgo- How would you personally go about it if your goal was to prevent interaction of WLAN with LAN connected PCs ( in same household)? Any straight forward way to achieve such separation via command line or other settings in LInux/Windows? Commented May 22, 2020 at 0:20
  • 1
    The way I would personally do it (and have more-or-less done) is to ensure my router runs dd-wrt and not bridge WIFI to Ethernet and have them in seperate vlans, but I draw on a skillset likely very different to yours. Depending on your router, there are a few options which are a lot easier - many routers have a "Wifi Isolation" feature which you can just turn on. Alternatively I'd get a second router, disable WIFI on it and then connect the WAN port of this router to a LAN port on the main router. There are limitations to this, but likely what you want.
    – davidgo
    Commented May 22, 2020 at 0:38
  • 1
    See superuser.com/questions/569710/… superuser.com/questions/1503686/… for some other approaches.
    – davidgo
    Commented May 22, 2020 at 0:40
  • ,@davidgo- can you quickly check this reference here community.sophos.com/products/unified-threat-management/f/… , the expert there says that VLAN method would not be enough to 100% isolate because there are some layers and each device would still be transparent to L3 traffic and share same L2 domain. Do you know what physical adapter I could add to my router so that a guest devices are always isolated from home devices? You have a amazon Link? Commented May 22, 2020 at 11:03
  • 1
    @threemianichole I don't see where he is saying that at all. In fact he says "Your best bet is to build VLANs according to importance, control being the most sensitive of all, like putting a vlan for each type of device"... Are you maybe confusing vlans with subnets, which are both talked about and are different. (If you have 2 subnets on the same vlan there can be leakage between them. If you have 2 subnets on seperate 2 vlans there can't be leakage)
    – davidgo
    Commented May 22, 2020 at 18:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .