Recall why this is even necessary
Back in Collision Domain vs Broadcast Domain: a router (or something doing Layer 3 work) is what breaks up broadcast domains, and VLANs exist specifically to create multiple broadcast domains on one switch. So naturally, getting traffic between two VLANs requires exactly the kind of device that breaks broadcast domains apart in the first place. A switch alone will never do it.
Option 1: Router-on-a-stick
A single physical link runs from the switch to a router as an 802.1Q trunk, and the router carries a separate subinterface for each VLAN, each one acting as that VLAN's gateway. One physical interface, logically sliced into as many virtual ones as there are VLANs.
Option 2: Layer 3 switch with SVIs
A Layer 3 switch can do the routing itself, with no separate router at all. Each VLAN gets a Switched Virtual Interface (SVI), a virtual interface configured directly on the switch that acts as that VLAN's gateway. Since the switch is already routing in hardware at wire speed, this scales far better than funneling all inter-VLAN traffic through one router link.
| Router-on-a-stick | L3 switch with SVIs | |
|---|---|---|
| Extra hardware needed | A router, plus a trunk link | None, the switch does it natively |
| Throughput | Limited by the one trunk link | Wire-speed, routed in hardware |
| Common in | Small networks, labs, legacy setups | Most modern production networks |
Router-on-a-stick is genuinely useful for learning the concept with minimal hardware, but every inter-VLAN packet has to leave the switch, cross the trunk, get routed, and come back: a real bottleneck under load. An L3 switch's SVIs remove that round trip entirely, which is why they're the default choice once a network outgrows a lab setup.