35

You often hear the terms Subnet and VLAN used interchangeably. With the ubiquitous nature of IP these days, when are the two not considered roughly the same from a high-level, understanding that VLANs are L2 and Subnets are L3. In other words, are there any cases for having a VLAN without a Subnet, and still have IP (L3) communication? [Also ignoring that all networks are not subnets when considering classful networks which all are really just CIDR prefixes these days.]

13 Answers 13

43

If they are used interchangeably then they are used incorrectly.

Subnet refers to particular IP network, such as 192.0.2.0/28.

VLAN refers to 802.1Q standard, in which you can essentially give each port unique MAC address table, effectively separating them from each other.

VLAN may transport one or more subnet (but does not have to, it may be transporting something else than IP entirely). Subnet may be configured for VLAN, but does not have to be, it could be without 802.1Q or over some completely different L2 technology than ethernet.

  • The last paragraph is closer to what I was looking to see, though the question was phrased around IP only. – generalnetworkerror May 26 '13 at 10:12
  • But to use them interchangeably you would need to remove all other conditions. Maybe in some companies VLANn has direct, unambiguous mapping to subnet Y, but it does not mean you could use them interchangeably in any practical way. – ytti May 26 '13 at 10:14
  • VLANs are a way to split a single L2 media into multiple Broadcast Domain, effectively creating "virtual" layer 2 networks VLANs are usually used in switches to separate ports into distinct network The actual separation depends on the architecture, it can be along administrative lines (departments) or technological lines (PC, Server, IP Phones, Printers) The 802.1Q Standard is only for Trunking purpose (multiple VLAN in a single link), by way of a Tag that is included in the 802.1Q Header that is inserted in the Ethernet Header and is a must when connection multiple switches using VLANs – Remi Letourneau Nov 7 '13 at 17:56
  • Devices are not VLAN aware. – thethakuri May 8 at 8:18
13

Subnets (L3) and VLANs (L2) are on different layers. The terms should not be used interchangeably. A VLAN can contain one or more L3 prefixes ("Subnets"). For a layman this could cause confusion. Often people don't understand that these two are connected but not the same. People might say The host located in our server subnet or The server located in the DMZ VLAN and mean the same thing.

  • 1
    The multiple subsets per VLAN concept is a big one to keep in mind and many people forget. – YLearn May 26 '13 at 13:50
11

This is a very informal way of looking at the difference between VLANs and subnets, but it's not inaccurate (just incomplete). It may help networking newcomers get a little bit closer to the right mental picture.

Two different VLANs on a single switch or host are like two physically separate switches. They partition the MAC address space, in that communications between two parties on a single VLAN or on a single physical switch don't involve any other parties on the MAC-level (layer 2) network. The VLAN or physical switch limits the extent of MAC-level message propagation, keeping it as local as possible.

In contrast, IP subnets exist at layer 3 and partition the IP address space, not the MAC address space, but with a similar purpose: to limit the extent of message propagation. Any partitioning at the MAC-level layer 2 network below is entirely transparent to layer 3, which means that VLANs and/or separate physical switches can be treated as one single continuous layer 2 medium from the point of view of IP-level networking.

Conversely, switches and VLANs don't even see IP addresses nor IP subnetting (with some minor provisos which can complicate the picture). Everything at layer 3 and higher is just payload to them at the layer 2 MAC level.

In summary: VLANs and subnets partition different layers of the network model. There is no circumstance in which they are interchangeable terms.

3

They are only used interchangeably from a perspective of each unique vlan at layer 2 should have its own subnet for addressing at layer 3 giving you separation and ability to manage broadcast traffic etc.

In terms of scenarios where you would have a vlan without a subnet then only perhaps if using an 'ip unumbered' setup but there are not too many reasons to want to have to do this. If you review some best practice models like Cisco's composite network model then in terms of keeping individual subnets and your vlans 'local' to switch blocks then you would generally have a separate subnet assigned per vlan.

  • 2
    There are lot of reasons to run VLAN without subnet, IP is just one of the many protocols you can carry over ethernet. en.wikipedia.org/wiki/EtherType for list of others, some of them are very common, such as MPLS – ytti May 26 '13 at 10:26
  • Yes agreed, I was just looking at this from an IP perspective and the relationship in terms of correlating vlans with unique subnets. Arguably one can view mpls as a means of tunnelling IP :) – MattE May 26 '13 at 12:36
3

In many implementations an IPv4 subnet and a VLAN are closely correlated on a 1:1 basis. A subnet, strictly speaking is a portion of IPv4 address space from which one may assign addresses to hosts. This is differentiated from a "prefix" a term used in the common parlance or a supernet, which may be a some larger portion of IP address space that is comprised of many subnets.

The reason for the correlation is that a single VLAN and a single subnet both represent a single broadcast domain. As such, these two tend to be overlaid in most implementations. As described in earlier answers, a VLAN is a layer 2 entity. All hosts on a given VLAN can communicate with each other, but no hosts on one VLAN can communicate to hosts on another without some form of routing or in rare cases, bridging.

2

A lot of the responders said the terms should NOT be used interchangeably. Actually I think it is perfectly acceptable and common practice amongst people who DO know the difference to use the terms interchangeably when talking about IP on ethernet networks. In fact they pretty much should be synonymous in most circumstances (there's always exceptions) since both define a broadcast domain and your L2 and L3 broadcast domains should normally be identical.

2

A VLAN is an Ethernet level concept, a subnet is an IP level concept.

A VLAN splits an Ethernet network into multiple logically seperate Ethernet networks.

A subnet defines which hosts a host will try to communicate with directly verses which hosts will need to go via a router. It also defines "network" and "broadcast" addresses.

It is common practice to have a 1:1 mapping between subnets and VLANs but it is perfectly possible to have multiple subnets on the same VLAN. Equally it is possible to use proxy arp to split a subnet between multiple VLANs or even have two VLANs using the same IP subnet for different purposes.

1

They are very much different. However a lot of terms (megabit, megabyte, memory, hard drive, etc) get miscommunicated.

Often we have customers asking us to move a vlan from one site to another, when really what they want is to move a subnet over.

You get used to it, even though I try and correct them (politely)

1

In other words, are there any cases for having a VLAN without a Subnet, and still have IP (L3) communication? [Also ignoring that all networks are not subnets when considering classful networks which all are really just CIDR prefixes these days.]

some routing protocols can be in the same L2 domain and support the likes of apple talk or other non IP L3/4 protocols. These would need to be in the same L2 domain but not be in the same IP subnet, since IP is not required. In such a case it may be practical to use VLANS without considering IP/Subnetting of any kind.

0

The difference between the two is one of significance. VLANs are generally only locally unique while subnets are usually unique across an organization.

Folks 'in the know' understand that vlan 100 in campus 1 is different than the one at campus 2 if the subnet of one is 192.168.1.0 and the other is 192.168.2.0 But you could have vlan 100 repeated in every building across a campus if you separate them by layer-3 boundaries and use different subnets.

And then there there are the exceptions to the rules or the bad designs that get worked around with duct tape and NAT pools...

-1

In my experience, these days, they are considered the same until you use a protocol other than IP directly on top of Ethernet.

-2

Put another way, subnets are, technically, a division of the address space at the L2 level -- it's more of a routing decision than anything else. VLANs are tunneled LAN frames within the payload of other LAN frames. Ignoring the various standards for a moment, if you put a packet analyzer on the cable, you'd see:

For a subnetted LAN, you'd see the same traffic. THere's no easy way to look at a subnetted LAN and tell it is, in fact, subnetted. For VLANs, you'd actually see ethernet frames carrying a VLAN tag, which then carry another ethernet frame inside of them.

Subnet frames are easily handled by equipment -- you can choose to ignore the subnet at a given moment if you want to, for example, have a transparent proxy watch some trafic. VLANs are tunnels.

  • Your description of a VLAN is only true on a tagged or trunk port, nor are they tunnels in any sense. – YLearn May 28 '13 at 16:56
  • VLANs are pure Layer 2 concepts, routing has nothing to do with VLANs (you are routing the L3 running on the VLAN, not the VLAN themselves). Subnet frames.. that doesn't even exists.. Ethernet Frames (at Layer 2) or IP Packet (at Layer 3) – Remi Letourneau Nov 7 '13 at 17:47
-3

VLANs carve a switch into multiple virtual switches.
Subnets carve an IP network address into multiple smaller network addresses.

  • I don't mind late answers when they add something. Other than brevity, I don't find this providing anything to this two year old question. As a very brief answer, this is both it's strength and weakness. I could just as easily say "VRFs carve a switch into multiple virtual switches" and someone could then assume VLANs and VRFs are similar/the same. – YLearn May 31 '15 at 4:30
  • VRF is not a layer 2 (switching) technology. "Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away." Antoine de Saint-Exupery – Ron Royston May 31 '15 at 15:48
  • 1
    Hmm, no? Perhaps you need to update your information? And taking too much away is often as bad or worse than having too much. - Myself – YLearn Jun 1 '15 at 1:38

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