Cisco NX-OS VLAN & Switchport Config
VLAN database, SVI interfaces, trunk and access switchport configuration for Cisco Nexus switches.
What is it?
NX-OS VLAN configuration is similar to IOS with key differences. NX-OS requires 'feature interface-vlan' to create SVI interfaces. NX-OS uses HSRP (Hot Standby Router Protocol) version 2 for gateway redundancy — in a vPC pair, both switches run HSRP but only one is active per VLAN. For VXLAN EVPN deployments, VLANs are mapped to VNIs using 'vn-segment' commands. NX-OS also supports 'spanning-tree port type edge' instead of IOS 'spanning-tree portfast' for fast port convergence.
When to use
- ·Segmenting server traffic in data center environments (servers, storage, management VLANs)
- ·Defining VLAN-to-VNI mappings in VXLAN EVPN fabrics
- ·Configuring SVIs with HSRP for redundant default gateways on vPC leaf pairs
- ·Any standard Layer 2 segmentation requirement on Nexus switches
When NOT to use
- ·For VXLAN EVPN tenants — use the bgp-evpn template which handles VNI-to-VLAN mapping and VRF configuration
- ·When you have more than ~4000 VLANs — use VXLAN VNIs for scale beyond the 4094 VLAN limit
How it compares
Prerequisites
- →'feature interface-vlan' must be enabled before SVIs can be created
- →'feature hsrp' must be enabled if using HSRP for gateway redundancy
- →For vPC deployments, HSRP virtual IPs must match on both vPC peers
- →VLANs used for VXLAN must also have 'vn-segment' mappings (see bgp-evpn template)
Config Generator
Verification commands
show vlan briefList all VLANs and their status
ExpectedAll configured VLANs should show 'active'. VLANs show as 'act/lshut' if suspended.
show interface vlan <id>Verify SVI status and IP address
ExpectedInterface should be up/up. Line protocol up only when a port in the VLAN is active.
show hsrp briefShow HSRP state for all SVIs
ExpectedOne switch should show 'Active', the other 'Standby'. Active hold the virtual IP and responds to ARP.
show interface trunkShow trunk interfaces and which VLANs are active on each trunk
ExpectedVLANs should appear in the 'VLANs in STP Forwarding' column for them to carry traffic.
Debug commands
show spanning-tree vlan <id>Show spanning tree topology for a specific VLAN
Common mistakes & fixes
Further learning
Recommended books to go deeper on this topic.
CCNA 200-301 Official Cert Guide Library
Wendell Odom · Cisco Press · VLANs, trunk ports, DTP, VTP, inter-VLAN routing
CCNP Enterprise Core ENCOR 350-401 Official Cert Guide
Brad Edgeworth et al. · Cisco Press · Advanced switching — STP, RSTP, MST, PVST+