# How do VLAN's work with subnets? [duplicate]

I know how to subnet but I'm a bit confused when it comes to how VLAN's work within a network. Say i have 3 different groups of users, split on 2 different levels of a building.

Ground floor = 5 students, 5 teachers First floor = 5 students, 5 teachers

Logic tells me the ground floor would be on it's own subnet, same with the first floor. But I also want the students to be on their own VLAN, and the teachers on their own. How does this work if the ground and first floors have their own subnet? ie whole first floor = 10.1.1.2-12 and ground floor 10/1/2/2-12

Thanks in advance for any explanation or if I'm heading in the wrong direction

• This almost sounds like a homework question to me. Could you at least clarify what you are trying to accomplish? You mention three groups of people, but then only list two. What is your reasoning for separating the groups? Apr 25, 2014 at 1:19
• Thanks, not a homework question at all. Just started a networking course at uni and we are touching on VLAN's. I want to try get my head around it before we approach the topic. I meant 2 user groups btw, not 3. After doing some research, I've found that each VLAN should be on it's own subnet. IP addresses aside, I would assume a VLAN for students would all have the same subnet, even though they are on different floors. Same as teachers. Is that how it works? Apr 25, 2014 at 1:25
• There are already several questions on this site that discuss VLANs/subnets. Not convinced this is exactly a duplicate, but start by referencing those: Question 1, Question 2, Question 3 Apr 25, 2014 at 1:34

Depending on where you are in your University classes, there are three options.

If you have already covered "Layer 3 Switching", you could set up an SVI for the Students, and an SVI for the Teachers. Then the first floor and ground floor would only need a Layer2 path (aka through switches) to your Layer 3 switch. Then you could have these two VLANs existing at two different locations.

If you haven't already covered "Layer 3 Switching", and you are purely in a "Router L3" and "Switch L2" world, then unless you do something special (see below) you will probably need to use four different VLANs and four different IP Subnets: A Students 1st Floor, B Students Ground Floor, C Teachers 1st Floor, D Teachers Ground Floor.

You could get around that and (in a way) do a manual "L3 switch" by connecting your central router to a switch, and then that switch has a trunk to each of your "Floor" switches. You could then have one VLAN/IP Subnet for Teachers, and another for Students, and they could exist in two different locations.

There are exceptions, but generally speaking, there is a one-to-one match between VLANs and subnets. In other words, for every VLAN, you have a subnet, and vice versa. So you would have two subnets (and two vlans) on each floor -- one for students and one for teachers.

• Personally I disagree with this answer as it seems to enforce that VLANs and subnets are "the same" and this is just not the case. VLANs are L2 divisions and subnets are L3. I have seen many cases where there is no one-to-one correlation between VLANs and subnets. I have seen VLANs with multiple subnets, the same subnet on multiple VLANs, VLANs with no subnet at all, etc. Apr 25, 2014 at 22:38
• @ylearn Yes, I understand the distinction, and as I said, there are exceptions. But I think you will agree that for the vast majority of networks it hold true. And in this particular case, would you do it differently? Apr 25, 2014 at 23:56
• I wouldn't personally be able to say "the vast majority" as I have nothing to back that up. I have seen many networks where this wasn't the case. As a case in point, many universities used or still use netreg (poor man's NAC) which involves the use of multiple subnets per VLAN. In this particular question, it depends on a number of factors. For instance many classrooms now use collaborative software, so I may not use a separate VLAN for teachers/students as this may break the ability to use this types of software. Apr 28, 2014 at 2:14
• @YLearn Perhaps we will simply have to disagree. I have seen a lot of networks, and the cases where there isn’t one subnet per vlan are rare, in my experience. I will reiterate that there are exceptions as you mention. But I maintain that these are unusual instances, and most network designers try to avoid doing this unless absolutely necessary. You may have an application as you describe, that requires hosts to be on the same VLAN. The very idea of a “poor mans” application implies (for me), that it is something you’d only do if you had to, and wouldn’t be part of a modern network design. Apr 28, 2014 at 22:45