Cisco Nexus NX-OS VLAN and Trunk Configuration Step by Step - 夜莺博客

Cisco Nexus NX-OS VLAN and Trunk Configuration Step by Step

Cisco Nexus switches are the workhorse of modern data centers, but their NX-OS syntax — though conceptually identical to IOS VLANs — differs in enough details to trip up campus-trained engineers. This step-by-step lab guide configures a three-switch Nexus topology: trunk ports between switches, two named VLANs, access port assignment, and allowed-VLAN filtering, followed by the verification commands that prove the config. We finish with modern best practices such as spanning-tree port type and disabling unused ports.

Task 1: Configure Trunk Ports

configure terminal
interface ethernet1/1-4
switchport
switchport mode trunk
no shutdown
end
copy running-config startup-config

Trunk ports carry multiple VLANs using 802.1Q tagging — the 4-byte VLAN tag is inserted into each Ethernet frame.

Task 2: Create VLANs and Assign Access Ports

configure terminal
vlan 10
name USERS_VLAN10
vlan 20
name SERVERS_VLAN20
interface ethernet1/5-6
switchport
switchport mode access
switchport access vlan 10
no shutdown
interface ethernet1/7-8
switchport
switchport mode access
switchport access vlan 20
no shutdown
end
copy running-config startup-config

Task 3: Restrict VLANs on Trunks

Best practice: explicitly permit only the VLANs you need instead of relying on the default allow-all behavior.

configure terminal
interface ethernet1/1-4
switchport trunk allowed vlan 10-20
end
copy running-config startup-config

Verification Commands

show vlan brief
show interface trunk
show interface status
show mac address-table

Modern NX-OS Best Practices

Add descriptions, spanning-tree port types and disable unused ports:

configure terminal
feature interface-vlan
interface ethernet1/1-4
description TRUNK_TO_CORE
switchport mode trunk
switchport trunk allowed vlan 10,20
spanning-tree port type network
interface ethernet1/5-6
description USER_ACCESS_PORTS
switchport mode access
switchport access vlan 10
spanning-tree port type edge
interface ethernet1/20-48
shutdown

NX-OS vs Classic IOS

The biggest differences: NX-OS uses interface ethernet1/1-4 ranges directly (no interface range keyword), requires feature commands to enable features like interface-vlan, and has modular process isolation with advanced APIs for automation.

Related Articles on This Site

Continue with Nexus 9000 VXLAN BGP EVPN design, Nexus vPC failover troubleshooting and Cisco inter-VLAN routing.

原文链接:https://datadivewithsubham.blogspot.com/2026/05/step-by-step-cisco-nexus-switch.html