layer 2 and 3 switches

Hello,
I would like to have a nice explanation on a couple of things regarding layer 2 & 3 switches. The last time I asked this question it kind of went in different directions, so to avoid that I'll try and be clearer. These things below are what I do not need explanations on (followed below that I will explain what I need to understand better). What I do not need explanations on:
- I understand what vlans are
- I understand the difference between layer 2 & 3 switches
- I know what vlan trunking\tagging is
- I know what a default gateway is
- I understand that Layer 3 switches does the IP routing and layer 2 doesn't (mac addresses).

What I need to understand clearly is:

When I look at a layer 2 switch (show run) I see that the default vlan1 has no ip address and is shut down, a new vlan was created vlan10 and this vlan was given an IP address and default gateway. But the switch its self was given an IP address as well.

For ex:
interface Vlan1
 no ip address
 shutdown
!
interface Vlan10
 ip address 10.10.50.2 255.255.255.0
 ip helper-address 10.10.50.101
 no ip route-cache
!
ip default-gateway 10.10.50.20

So I'm assuming the default gateway for the pc's that connect to this switch is 10.10.50.20 which is also the IP of the inside interface of the firewall.

So if that is correct then this is what I don't understand:
Why is there an IP for interface and DG address for vlan10?
Why do I read that there can only be 1 management vlan per switch? What do they specifically mean by management vlan? There has to be obviously an IP address to telnet into (10.10.40.2)? But if its used for management only why then are almost all the interfaces associated with that vlan10?

Shouldn't there be a vlan interface to access the switch and another vlan for all the computers to associate with?

So basically I need to understand better the concept of interface vlan and management vlan and ip default gateway.

Thanks!
LVL 7
tolinromeAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
Don JohnstonConnect With a Mentor InstructorCommented:
Right but how does the switch know if I have more than one management vlan, I can create 50 vlans if I want

Technically, (on Catalyst switches), there is no "management" VLAN.  All VLANs are the same. Which one you chose to use for management is just a decision that you make.  On layer-2 switches, only one SVI can be active at any one time. The only purpose of that SVI is for switch management.  Which, by extension, would make that VLAN the management VLAN.  But that VLAN could also be one of the regular data VLANs.

At the end of the day, the VLAN that you chose for management is an in-band management path. The only true out-of-band management port is the console port. Now on Nexus switches, there is an out-of-management port.
0
 
SpencerScannellCommented:
Well, the interface vlan 10 is what you would set the default gateway to the devices on vlan 10. So for the computers it would be 10.10.50.2. You typically make a different "Switched Virtual Interface" for every vlan and set that as the default gateway for the devices on that vlan. If the switch is only in layer 2 then the ip default gateway command is used. If it is in layer 3 there will either be a route for traffic or the ip route command will be used Hope this helps clarify things a little bit.
0
 
tolinromeAuthor Commented:
Is that the standard way of doing things? The devices that are part of vlan10 are using as their default gateway the address that is ip default-gateway 10.10.50.20 and all is working. I still need an explanation, also about the management vlan etc.
Thanks.
0
What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

 
SpencerScannellCommented:
That's because all traffic is being sent to .20.
The way I do it is a different subnet for each VLAN, and then a different subnet between the switch and router. As far as I know the management VLAN is for an out of band way to send management traffic on a different VLAN than normal user traffic.
0
 
tolinromeAuthor Commented:
Right but how does the switch know if I have more than one management vlan, I can create 50 vlans if I want
0
 
SpencerScannellConnect With a Mentor Commented:
Right, you can. The reason you can only have one management VLAN on a switch is because a purely layer 2 switch only can assign an IP to VLAN 1. In a multi-layer switch you can have as many as you want. However, people typically only use one, if at all.
0
 
InfamusCommented:
Now on Nexus switches, there is an out-of-management port.
Typo..    :-)
0
 
tolinromeAuthor Commented:
spenserscannell - On your first respone:

"Well, the interface vlan 10 is what you would set the default gateway to the devices on vlan 10. So for the computers it would be 10.10.50.2. You typically make a different "Switched Virtual Interface" for every vlan and set that as the default gateway for the devices on that vlan. (Is this layer 3?)

If the switch is only in layer 2 then the ip default gateway command is used. (Layer 2)

If it is in layer 3 there will either be a route for traffic or the ip route command will be used Hope this helps clarify things a little bit. " (Layer 3)

Correct?
--------------------------------------------------------------------------------------------------------------------------

Yes, its a layer 2 switch I'm talking about. I understand now what youre saying but, what confuses me is that are the clients looking to the switch as their default gateway or the firewall? The firewall inside IP is 10.10.50.20, which is the ip default-gateway of the layer 2 switch. So I'm assuming then that that is just the IP the switch uses (just like the pcs in vlan10 for their default gateway). Correct?

And if its a layer 3 switch and I have say 5 vlans, I will then have 5 vlan interfaces with all their own default gateways corresponding to the subet their on.

It seems that the example I wrote in the question is using the interface vlan 10 as their management interface (IP) and the vlan for the clients as well.
Correct?



donjohnston - thanks for the explanation on the management vlan, totally got that now.
0
 
tolinromeAuthor Commented:
anyone?
0
 
Don JohnstonInstructorCommented:
The default gateway for 10.10.50.0/24 network would be a routing device (or firewall) on that network. So in your case, it sounds like 10.10.50.20 is the correct gateway.

If you have a multi-layer switch, then there would be 5 SVI's (VLAN interfaces). Each SVI will have an IP address for that network. The hosts on those networks would use the SVI IP address on their network.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.