CCNA · Lesson 10 of 13
Inter-VLAN Routing with a Layer 3 Switch and SVIs
The most common approach in companies: the switch itself routes between VLANs, with no router and no bottleneck.
In a nutshell
A Layer 3 switch routes between VLANs using one virtual interface (SVI) per VLAN and the ip routing command.
In this lesson
What is an SVI?
An SVI (Switch Virtual Interface) is a virtual interface that represents a VLAN inside the switch. It is created with interface vlan 10 and given an IP. That IP is the gateway of the PCs in VLAN 10.
Configuration
SW-L3(config)# ip routing ← without this the switch does NOT route
SW-L3(config)# interface vlan 10
SW-L3(config-if)# ip address 192.168.10.1 255.255.255.0
SW-L3(config-if)# no shutdown
SW-L3(config)# interface vlan 20
SW-L3(config-if)# ip address 192.168.20.1 255.255.255.0
SW-L3(config-if)# no shutdown
When is an SVI up/up?
- The VLAN exists on the switch and is active.
- There is at least one active port in that VLAN (access, or a trunk that allows it) in STP forwarding state.
- The SVI is not in
shutdown.
If you create interface vlan 30 but no port is active in VLAN 30, the SVI stays up/down.
Routed port towards the router or firewall
To connect the Layer 3 switch to the Internet router, a routed port is usually used: switching is removed from the port and it gets an IP, like a router interface.
SW-L3(config)# interface g1/0/24
SW-L3(config-if)# no switchport
SW-L3(config-if)# ip address 10.0.0.1 255.255.255.252
Management SVI on a Layer 2 switch
A Layer 2 switch also has SVIs, but not to route: they are used to manage it over SSH. Since it does not route, it needs its own gateway (see the management VLAN lesson):
SW1(config)# interface vlan 99
SW1(config-if)# ip address 192.168.99.11 255.255.255.0
SW1(config-if)# no shutdown
SW1(config)# ip default-gateway 192.168.99.1
Router-on-a-stick vs. SVI
| Router-on-a-stick | Layer 3 switch (SVI) | |
|---|---|---|
| Where routing happens | On the router, in software | On the switch, in hardware (ASIC) |
| Performance | Limited by one link | High, no bottleneck |
| Cost | Low | Higher (Layer 3 switch) |
| Typical use | Small branches, labs | Campus and enterprise |
What you must remember
- SVI = interface vlan X, the gateway of that VLAN.
- A Layer 3 switch needs ip routing.
- An SVI is up if the VLAN exists, has an active port and is not shut down.
- no switchport turns a port into a routed port.
Check what you learned
4 exam-style questions. Some have one answer and others ask you to choose several. Answer them all to complete the lesson.