I know that the layer 2 doesn't understand IP, and the broadcast domain is same.

Why can't devices talk, how does it happen?

  • Are you referring to two subnets on the same VLAN, from your previous question? – Ron Trunk May 7 '17 at 19:41
  • yes in the same default VLAN – Nina May 7 '17 at 19:44
  • Sorry for the hairsplitting, but your question asks for, why devices in different subnets can't talk. The answer is: yes, they can talk. Now I am sending this comment from a very different subnet as the subnet of the stackexchange frontend serverfarm. My device, and the device of the SE frontend gateway, can communicate without any problem. – peterh - Reinstate Monica May 8 '17 at 0:46
  • Furthermore, "and the broadcast domain is same.". Same as what? There is not even "broadcast domain" in l2. There is a broadcast address, which is ff:ff:ff:ff:ff:ff on Ethernet. – peterh - Reinstate Monica May 8 '17 at 0:48
  • Peter, surely you they can talk usin routers but I.mean with out router. – Nina May 8 '17 at 0:49

Devices in different subnets can communicate. That is the purpose of a router. Routers route packets between different networks.

Even if devices in different networks are on the same layer-2 broadcast domain, you need a router to let the devices communicate at layer-3. That is because each host will compare the destination layer-3 address and its own layer-3 address and mask to see if they are on the same network. If the destination host is on a different network, the host will send the packets in layer-2 frames to its configured gateway (router).

The host must assume that the destination network could be across the world from its network, and the gateway is the host on the network that knows how to forward packets toward the destination network.

| improve this answer | |
  • Thanks, this is Absolutely clear , I have a simple question ,if there are many networks on the switch they are considered in the same domain and broadcasts will flow to all networks ? – Nina May 7 '17 at 19:53
  • 3
    That depends. A VLAN is a broadcast domain. If you have multiple VLANs on one switch, then you have multiple broadcast domains. If you have multiple networks on the same VLAN, then layer-2 broadcasts will reach every host on the VLAN, regardless of the network. Hosts on a different network will ignore layer-3 broadcasts on a different network, but the broadcast will still interrupt every host. You use VLANs to break up the broadcast domains. – Ron Maupin May 7 '17 at 19:57

In linux...

Three computers, one has two interfaces, the other two on different subnets. The one with two is technically a router in function. And a router would be simpler.

The missing parts for me was the -A FORWARD in both directions on the bridging computer for iptables. And the remote clients need a route to respond to each other.

ip route add via

for one client

ip route add via

for the other client

Where the bridging computer has two interfaces, one statically assigned and one statically assigned

I needed this to use my pulseaudio server that I put on a different subnet and because I ran out of ports on various switches / routers. And I wanted to keep audio/file traffic different from internet traffic.

| improve this answer | |
  • This doesn't answer the question why. – Zac67 May 25 at 18:04
  • 1
    "The one with two is technically a router in function." is wrong. A device with 2 interfaces in different subnets is not necessarily a router. It is a multi-homed host. The fact that linux has routing capabilities is a different matter. – JFL May 25 at 18:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.