Module 4.4 45 minIntermediate

Inter-VLAN routing

Three ways to route between VLANs: a separate router interface per VLAN (legacy), a single router-on-a-stick using subinterfaces, and an L3 switch with SVIs (Switched Virtual Interfaces). This chapter walks through the two modern patterns end to end.

Course plan — preview

What you'll learn

  • Configure router-on-a-stick with subinterfaces and 802.1Q encapsulation.
  • Configure SVIs on an L3 switch and enable ip routing.
  • Choose between router-on-a-stick and L3 switch for a given scale.

Router-on-a-stick — one trunk, many VLANs

Connect a single router interface to a switch trunk port. Create one subinterface on the router per VLAN, each with its own IP and 'encapsulation dot1Q <vlan>' command. Each PC's default gateway is the router subinterface IP for its VLAN.

The physical port carries no address of its own; it only has to be up (no shutdown). The encapsulation goes on each subinterface, never on the physical port, which every VLAN shares. A subinterface number such as .10 is only a label: the VLAN it serves is set by encapsulation dot1Q, and matching the two numbers is a convention that keeps the configuration readable.

R1(config)# interface Gi0/0
R1(config-if)# no shutdown
R1(config)# interface Gi0/0.10
R1(config-subif)# encapsulation dot1Q 10
R1(config-subif)# ip address 10.0.10.1 255.255.255.0
R1(config)# interface Gi0/0.20
R1(config-subif)# encapsulation dot1Q 20
R1(config-subif)# ip address 10.0.20.1 255.255.255.0

SVIs on an L3 switch — line-rate routing

An SVI (interface VlanX) is a virtual L3 interface inside a switch that represents the entire VLAN as a single routable interface. With ip routing enabled the switch forwards inter-VLAN traffic in hardware — far faster than a single router-on-a-stick link.

Switch(config)# ip routing
Switch(config)# interface Vlan10
Switch(config-if)# ip address 10.0.10.1 255.255.255.0
Switch(config-if)# no shutdown
Switch(config)# interface Vlan20
Switch(config-if)# ip address 10.0.20.1 255.255.255.0
Switch(config-if)# no shutdown
An SVI only comes up/up when its VLAN exists in the VLAN database AND at least one port carrying that VLAN (an access port in it, or a trunk allowing it) is up — the autostate rule. A new SVI that stays down/down despite no shutdown almost always means the VLAN was never created or has no live ports. SVIs never take encapsulation dot1Q (that is a router-subinterface command), and ip routing controls forwarding between SVIs, not whether one comes up.

9 more sections in this chapter, plus a 4-question quiz and a hands-on lab.

Course plan

Modules 2–8 are part of the Course & Lab Pass and All-Access Max — start with a free account

You can see the title, summary, learning objectives and the opening sections. The rest of this chapter, like all of modules 2–8, comes with the Course & Lab Pass and All-Access Max. A free account opens Module 1: How Networks Work end-to-end and saves your labs — start there, no card required.

  • Read every chapter in Module 1 — How Networks Work
  • Save labs of up to 5 devices
  • Save up to 3 topologies
  • See the full course syllabus + chapter titles

Free account · no card required · compare plans any time

Build it step by step