1

It is my understanding that Vlans separate broadcast domains, but I often see people say, "subnets define a broadcast domain" as well.

Is it correct to say, "Vlans define a L2 broadcast domain, and subnets define a L3 broadcast domain"?

For example:
Host A: 10.0.1.1/24, Vlan 10
Host B: 10.0.2.1/24, Vlan 10

These two hosts are on the same vlan, therefore they should be able to communicate at L2 via their MAC addresses without routing. (Please correct me if I'm wrong)

However, the hosts are on different subnets. So that means packets must be sent to the default gateway and routed.

I'm having trouble understanding how these can both be true, as well as how communication between the hosts would differ if they were on the same subnet instead. Any clarification would be greatly appreciated, thanks.

1
  • Did any answer help you? If so, you should accept the answer so that the question doesn't keep popping up forever, looking for an answer. Alternatively, you can post and accept your own answer.
    – Ron Maupin
    Dec 17, 2020 at 17:37

2 Answers 2

3

These two hosts are on the same vlan, therefore they should be able to communicate at L2 via their MAC addresses without routing.

They could communicate in L2 but they can't in L3. IP uses the local routing table before sending to find out how to send a packet. Since the destination is outside the local subnet, the use of a gateway is required - even though the destination is in the same L2 segment/VLAN, but IP simply doesn't know.

There are ways to get around this limitation: use a special routing entry (not supported on all platforms) or use a fake gateway with static ARP. But usually it's best to simply put neighbor hosts in the same subnet.

5
  • Thanks for your reply, Zac67. I still have a couple questions.."They could communicate in L2 but they can't in L3". Doesn't this effectively mean that 2 hosts on the same Vlan can only communicate at L2 if they are in the same Subnet as well? Or another way to say it would be, "If they can already communicate at L2, why does it matter if they are in the same subnet or not at that point"? Thanks again.
    – bobbylg
    May 28, 2020 at 12:58
  • They won't communicate at L2 using the standard TCP/IP stack. If you have a layer 2 only protocol, like NetBIOS, or something similar, then yes they can.
    – Ron Trunk
    May 28, 2020 at 13:07
  • @bobbylg In L2, there are no subnets. Two nodes are either in the same segment (can talk) or they're not (can't talk). I was trying to point out that any protocol riding directly on top of L2 could be used - but we don't use these any more. ;-)
    – Zac67
    May 28, 2020 at 17:06
  • IP uses its own "routing" mechanism to find out if a node is "local" or requires a gateway. That mechanism prevents communication in this case.
    – Zac67
    May 28, 2020 at 17:07
  • The key to understanding the problem is that if you want IP communication to happen it needs to be able within the logic of the IP stack. Different subnets require a gateway - period. L2 is just employed by IP to make the actual transport - it doesn't work on its own (and L2 in turn uses L1 to move the data).
    – Zac67
    May 30, 2020 at 12:18
0

Is it correct to say, "Vlans define a L2 broadcast domain, and subnets define a L3 broadcast domain"?

I would agree with those terms. However, there really isn't a "layer-3 broadcast domain". A host may choose to ignore what it sees as a "foreign" broadcast, but at layer-2, the host will still receive it. When I first read your question, I thought "layer-2 broadcast domain" vs. "layer-3 broadcast address".

These two hosts are on the same vlan, therefore they should be able to communicate at L2 via their MAC addresses without routing. (Please correct me if I'm wrong)

This is 100% correct. ['tho a Bad Idea(tm). One should always strive to avoid the overlay network.] They can directly communicate, but it takes explicit configuration to do so, because they otherwise have no knowledge of the other network(s) on the wire with them. (this is typically handled with an "interface" route entry, proxy-arp-esq messing with the netmask, or (shudder) full-on proxy-arp.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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