Layer 2Global Config

interface vlan [id]

Creates a Layer 3 SVI (Switch Virtual Interface) for inter-VLAN routing or switch management.

Syntax·Global Config
interface vlan <vlan-id>

When to Use This Command

  • Configuring a management IP address on a switch (VLAN 1 SVI is most common).
  • Enabling inter-VLAN routing on a Layer 3 switch without a separate router.
  • Providing a default gateway for hosts in a VLAN.
  • Replacing 'router on a stick' with internal inter-VLAN routing on multilayer switches.

Command Examples

Configure switch management IP via VLAN 1 SVI

SW1(config)# interface vlan 1 SW1(config-if)# ip address 192.168.1.2 255.255.255.0 SW1(config-if)# no shutdown
%LINK-5-CHANGED: Interface Vlan1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan1, changed state to up

VLAN 1 SVI is now up with IP 192.168.1.2/24. The switch can be managed via SSH/Telnet from this IP. The SVI comes up when at least one port in VLAN 1 is in the up state.

Configure SVIs for inter-VLAN routing on Layer 3 switch

SW1(config)# ip routing SW1(config)# interface vlan 10 SW1(config-if)# ip address 192.168.10.1 255.255.255.0 SW1(config-if)# no shutdown SW1(config)# interface vlan 20 SW1(config-if)# ip address 192.168.20.1 255.255.255.0 SW1(config-if)# no shutdown

With 'ip routing' enabled, the switch routes between VLAN 10 and VLAN 20. Hosts in VLAN 10 use 192.168.10.1 as gateway; hosts in VLAN 20 use 192.168.20.1. No external router needed.

Understanding the Output

The SVI comes up only when at least one active port is in the associated VLAN. Use 'show interface vlan [id]' to check SVI status. SVI status depends on VLAN status — if the VLAN is deleted or all ports in that VLAN are down, the SVI goes down. 'ip routing' must be enabled for the switch to route between SVIs.

CCNA Exam Tips

1.

CCNA exam tip: SVIs require the VLAN to exist ('vlan [id]' must be configured) and at least one access or trunk port in that VLAN to be active.

2.

CCNA exam tip: 'ip routing' must be enabled on a Layer 3 switch for SVIs to route traffic — without it, SVIs only provide management access.

3.

CCNA exam tip: The VLAN 1 SVI is the most common management interface — always secure it (not just leave it at default).

4.

CCNA exam tip: SVI inter-VLAN routing is faster than 'router on a stick' because routing is done in hardware on multilayer switches.

Common Mistakes

Mistake 1: Creating an SVI for a VLAN that doesn't exist — the SVI stays in a down/down state.

Mistake 2: Forgetting 'no shutdown' on the SVI — SVIs are shutdown by default on some platforms.

Mistake 3: Not enabling 'ip routing' on a Layer 3 switch — SVIs exist but don't route between VLANs.

Related Commands

Practice for the CCNA 200-301

Test your knowledge with hundreds of CCNA practice questions covering all exam domains.

Practice CCNA Questions