Modern multi-layer switches seem to support both SVIs (switch virtual interfaces) and subinterfaces concepts. Both are virtual layer 3 concepts used to perform routing functions and some equipment supports both.
Sometimes the documentation can even put composite limits on both SVIs and subinterfaces, highlighting the similarities as well. Here is a snippet for Cisco Catalyst 9500 Series Switches.
You cannot configure more than 4,000 Layer 3 VLAN interfaces. The sum
of all the routed interfaces, SVI interfaces and subinterfaces should
be equal to 4000 or less.
What are the differences between SVIs and subinterfaces for multi-layer switches? Can one always be used in place of another?
Best Answer
Another aspect to and expanding a bit what zac67 already gave in his answer:
VLAN IDs used on tagged (sub)interfaces of routed interfaces (a.k.a.
no switchport
) can be completely independent from the switch's "switching" context [1].In extenso: the VLAN tag used on the subinterface does not appear as a L2 VLAN on the switch, neither consumes nor is part of any instance of (per-VLAN-)spanning-tree, and won't be part of any VTP/GVRP setups etc. There can even be subinterfaces of multiple routed interfaces using the same (overlapping) VLAN tag - and they'd be completely independent: Sometimes, this s referred to as "port local VLAN awareness".
To give a freedhandedly composed config example, in pseudo Cisco config speak. Essentially, this is very similar to how classic routers (ISR G1, ISR G2, ISR 4K et) get VLAN aware subinterfaces (of course, classic routers don't need the "no switchport" part)
SVIs in contrast are based on the existence of the given VLAN (as in: "L2-VLAN") on the given switch. So to have an SVI, you'd need to first create the said VLAN, get its spanning-tree right, check if it's part of VTP/GVRP if so intended etc.
Then you'll make sure the switchports pertaining to it are set right (some will be
access vlan xxx
, some might beswitchport trunk allowed vlan xxx
, some with portfast, some without...), and then you can add the SVI by virtue ofinterface vlan xxx
.Since VLANs are unique per switch (at least for a plain vanilla, non VDC capable switch), this uniqueness restriction applies to SVIs, too. You can't have multiple
interface vlan xxx
for the same VLAN ID.[1] Well.. somewhat. There are/were switches (Cat6500, for example) that would consume a VLAN ID (henceforth hidden) when configuring a routed port, and they had their issues with or plainly did not allow tagged subinterfaces of such routed ports. Behind the scenes, they would internally configure a VLAN without spanning-tree, map the configured port into that VLAN, and add an SVI with the pseudo routed port's configured ip address).