Configuring VLANs

This chapter describes how to configure virtual LANs (VLANs) on Cisco NX-OS devices.

This chapter includes the following sections:

Finding Feature Information

Your software release might not support all the features documented in this module. For the latest caveats and feature information, see the Bug Search Tool at https://tools.cisco.com/bugsearch/ and the release notes for your software release. To find information about the features documented in this module, and to see a list of the releases in which each feature is supported, see the "New and Changed Information"chapter or the Feature History table in this chapter.

Information About VLANs


Note

Beginning with Cisco Release 5.2(1) for Cisco Nexus 7000 Series devices, you can create Fibre Channel over Ethernet (FCoE) VLANs. For more information, see the Cisco NX-OS FCoE Configuration Guide for Cisco Nexus 7000 and Cisco MDS 9500.


You can use VLANs to divide the network into separate logical areas at the Layer 2 level. VLANs can also be considered as broadcast domains.

Any switch port can belong to a VLAN, and unicast broadcast and multicast packets are forwarded and flooded only to end stations in that VLAN. Each VLAN is considered a logical network, and packets destined for stations that do not belong to the VLAN must be forwarded through a router.

Understanding VLANs

A VLAN is a group of end stations in a switched network that is logically segmented by function or application, without regard to the physical locations of the users. VLANs have the same attributes as physical LANs, but you can group end stations even if they are not physically located on the same LAN segment.

Any switch port can belong to a VLAN, and unicast, broadcast, and multicast packets are forwarded and flooded only to end stations in that VLAN. Each VLAN is considered as a logical network, and packets destined for stations that do not belong to the VLAN must be forwarded through a router. The following figure shows VLANs as logical networks. The stations in the engineering department are assigned to one VLAN, the stations in the marketing department are assigned to another VLAN, and the stations in the accounting department are assigned to another VLAN.

Figure 1. VLANs as Logically Defined Networks

VLANs are usually associated with IP subnetworks. For example, all the end stations in a particular IP subnet belong to the same VLAN. To communicate between VLANs, you must route the traffic.

By default, a newly created VLAN is operational; that is, the newly created VLAN is in the no shutdown condition. Additionally, you can configure VLANs to be in the active state, which is passing traffic, or the suspended state, in which the VLANs are not passing packets. By default, the VLANs are in the active state and pass traffic.

A VLAN interface, or switched virtual interface (SVI), is a Layer 3 interface that is created to provide communication between VLANs. In order to route traffic between VLANs, you must create and configure a VLAN interface for each VLAN. Each VLAN requires only one VLAN interface.


Note

See the for complete information on configuring VLAN interfaces, and subinterfaces, as well as assigning IP addresses. This feature must be enabled before you can configure VLAN interfaces.


VLAN Ranges


Note

The extended system ID is always automatically enabled in Cisco NX-OS devices.


The device supports up to 4094 VLANs in accordance with the IEEE 802.1Q standard in each VDC. The software organizes these VLANs into ranges, and you use each range slightly differently.

For information about configuration limits, see the verified scalability limits documentation for your switch.

This table describes the VLAN ranges.

Table 1. VLAN Ranges

VLANs Numbers

Range

Usage

1

Normal

Cisco default. You can use this VLAN, but you cannot modify or delete it.

2 to 1005

Normal

You can create, use, modify, and delete these VLANs.

1006 to 3967 and 4048 to 4093

Extended

You can create, name, and use these VLANs. You cannot change the following parameters:

  • The state is always active.

  • The VLAN is always enabled. You cannot shut down these VLANs.

3968 to 4047 and 4094

Internally allocated

These 80 VLANs and VLAN 4094 are allocated for internal device use. You cannot create, delete, or modify any VLANs within the block reserved for internal use.

3968 to 4095

Note 

4095 is reserved and unused as per 802.1Q standard.

Internally allocated

Beginning with Cisco Release 5.2(1) for Cisco Nexus 7000 Series devices, VLANs 3968 to 4095 are reserved for internal use in each VDC by default.

You can change the reserved VLANs to any other 128 contiguous VLAN range. When you reserve such a range, it frees up the range of VLANs that were allocated for internal use by default, and all of those VLANs are available for user configuration except for VLAN 4095. All VDCs inherit the new reserved range of VLANs.

Note 

VLAN 0 is reserved for 802.1p trafffic.

The software allocates a group of VLAN numbers for features such as multicast and diagnostics that need to use internal VLANs for their operation. You cannot use, modify, or delete any of the VLANs in the reserved group. You can display the VLANs that are allocated internally and their associated use.

Beginning with Cisco NX-OS Release 5.2(1), the system allocates a block of 128 reserved VLANs (3968 to 4094) for these internal uses. You can change the block of 128 reserved VLANs to occupy another range of 128 adjacent VLANs. For example, you can change the reserved block of VLANs to be 400 to 528. You cannot assign a previously created VLAN as part of the 128 range of reserved VLANs. Anytime you change the reserved block of VLANs for the device, you must do the following:
  • Enter the copy running-configuration startup-configuration command

  • Reload the device


Note

When you change the range of reserved VLANs, the existing configurations for the new range of VLANs get deleted. A warning note is displayed as in the following example:

switch(config)# system vlan 2000 reserve 
This will delete all configs on vlans 2000-2127. Continue anyway? (y/n) [no] y
Note: After switch reload, VLANs 2000-2127 will be reserved for internal use.
      This requires copy running-config to startup-config before
      switch reload. Creating VLANs within this range is not allowed.
switch(config)#

To return to the default block of reserved VLANs (3968 to 4094), you must enter the no system reserve vlan command. The write-erase procedure does not restore the default reserved VLAN range to 3968 to 4094.

Creating, Deleting, and Modifying VLANs

Beginning with Cisco NX-OS Release 5.1(1) , you can configure a VLAN without actually creating the VLAN. This procedure is used for IGMP snooping, VTP, and other configurations.


Note

By default, all Cisco NX-OS ports are Layer 3 ports.


VLANs are numbered from 1 to 4094 for each VDC. All ports that you have configured as switch ports belong to the default VLAN when you first bring up the switch as a Layer 2 device. The default VLAN (VLAN1) uses only default values, and you cannot create, delete, or suspend activity in the default VLAN.

You create a VLAN by assigning a number to it; you can delete VLANs and move them from the active operational state to the suspended operational state. If you attempt to create a VLAN with an existing VLAN ID, the device goes into the VLAN submode but does not create the same VLAN again.

Newly created VLANs remain unused until Layer 2 ports are assigned to the specific VLAN. All the ports are assigned to VLAN1 by default.

Depending on the range of the VLAN, you can configure the following parameters for VLANs (except the default VLAN):

  • VLAN name

  • VLAN state

  • Shutdown or not shutdown

Beginning with Cisco NX-OS Release 6.1(1), you can configure VLAN long-names of up to 128 characters. To configure VLAN long-names, VTP must be in transparent or in off mode. If VTP is in client or server mode, the VLAN long-name feature cannot be enabled. For more details about VTP, see the Configuring VTP chapter.


Note

See the Cisco Nexus 7000 Series NX-OS Interfaces Configuration Guide for information on configuring ports as VLAN access or trunk ports and assigning ports to VLANs.


When you delete a specified VLAN, the ports associated to that VLAN become inactive and no traffic flows. When you delete a specified VLAN from a trunk port, only that VLAN is shut down and traffic continues to flow on all the other VLANs through the trunk port.

However, the system retains all the VLAN-to-port mapping for that VLAN, and when you reenable or re-create, that specified VLAN, the system automatically reinstates all the original ports to that VLAN. The static MAC addresses and aging time for that VLAN are not restored when the VLAN is reenabled.


Note

Before Cisco NX-OS Release 5.1, commands entered in the VLAN configuration submode are immediately executed. Beginning with Cisco Release NX-OS 5.1 for Nexus 7000 Series devices, you must exit the VLAN configuration submode for configuration changes to take effect.


High Availability for VLANs

The software supports high availability for both stateful and stateless restarts, as during a cold reboot, for VLANs. For the stateful restarts, the software supports a maximum of three retries. If you try more than 3 times within 10 seconds of a restart, the software reloads the supervisor module.

You can upgrade or downgrade the software seamlessly when you use VLANs.


Note

See the Cisco Nexus 7000 Series NX-OS High Availability and Redundancy Guide for complete information on high availability features.


Virtualization Support for VLANs

The software supports virtual device contexts (VDCs), and VLAN configuration and operation are local to the VDC.


Note

See the Cisco Nexus 7000 Series NX-OS Virtual Device Context Configuration Guide for complete information on VDCs and assigning resources.


Each VLAN must have all of its ports in the same VDC. If you do not have enough resources allocated to the VDC, the software returns an error message.

When you create a new VDC, the device automatically creates a new default VLAN, VLAN1, and internally reserves VLANs for device use.

You can reuse the same numbers for VLANs in different VDCs.

One or more VLANs can be associated with a role to either allow or disallow the user to configure it. When a VLAN is associated with a role, the corresponding interfaces will also be subjected to the same check. For instance, if a role is allowed to access VLAN1, that role also has access to the interfaces that have that VLAN. If an interface does not have the VLAN associated with a role, that interface is not accessible to that role.

Prerequisites for Configuring VLANs

VLANs have the following prerequisites:

  • You must be logged onto the device.

  • If necessary, install the Advanced Services license and enter the desired VDC. Ensure that you have allocated enough resources for that VDC. See the Cisco Nexus 7000 Series NX-OS Virtual Device Context Configuration Guide for information on creating VDCs and allocating resources.

  • You must create the VLAN before you can do any modification of that VLAN.

Guidelines and Limitations for Configuring VLANs

VLANs have the following configuration guidelines and limitations:

  • The maximum number of VLANs per VDC is 4094.

  • You can configure a single VLAN or a range of VLANs.

    When you configure a large number of VLANs, first create the VLANs using the vlan command (for example, vlan 200 to 300, 303 to 500 ). After the VLANs have been successfully created, name or configure those VLANs sequentially.

  • VLAN 4094 is a reserved VLAN.

  • You cannot create, modify, or delete any VLANs that are within the group of VLANs reserved for internal use.

  • VLAN1 is the default VLAN. You cannot create, modify, or delete this VLAN.

  • VLANs 1006 to 4094 are always in the active state and are always enabled. You cannot suspend the state or shut down these VLANs.

  • An interface policer and CoPP classification does not work for the Layer 2 control traffic in native VLAN in the following scenarios:

    • When the native vlan (ID other than 1) command is configured on the interface and the native VLAN ID is missing in the configuration.

    • If the vlan dot1q tag native exclude control command is configured.

VLAN translation has the following guidelines and limitations:

  • A VLAN translation configuration is only applicable to Layer 2 trunks. It is inactive when applied to ports that are not Layer 2 trunks.

  • Do not configure translation of ingress native VLAN traffic on an 802.1Q trunk. The 802.1Q native VLAN traffic is untagged and cannot be recognized for translation. However, you can translate traffic from other VLANs to the native VLAN of an 802.1Q trunk.

  • The VLANs to which you are translating must be present in the trunk's allowed VLAN list. In addition, the VLANs that need to be forwarded on a trunk port, that are not involved in VLAN translation must also be included in the trunk ports allowed VLAN list. With per-port VLAN translation enabled, VLAN translation entries are consumed in hardware for all VLANs in the trunk ports allowed VLAN list.

  • Do not change the VLAN on an access port or a trunk port it will flap the interface. However, if the port is part of a vPC, then first change the native VLAN on the secondary vPC, and then on the primary vPC.

  • A VLAN translation must ensure that the original and translated VLANs are within the same MST instance.

  • The VLAN translation configuration applies to all ports in a port group. VLAN translation is enabled by default on all ports.

  • The number of supported VLAN translation maps is 4000. Layer 2 ports that have the same VLAN maps and the same trunk allowed VLAN list can benefit from sharing translation entries in hardware.

  • The following limitations apply to the number of translation entries per port, based on the module type:

    • For F1 Series modules: Translation entries are limited to 512 entries on two ports, shared in the ingress and egress direction. The translation entries can be shared across the two ports for 256 entries per port.

    • For F2 Series modules: You can configure up to 2000 translations per port in each direction (ingress and egress).

    • For F3 Series modules: You can configure up to 2000 translations per port in each direction (ingress and egress).

    • For M1 Series modules: Translation entries are limited to eight per port.

    • For M1 Series modules: VLAN translations are supported only in the dedicated mode.

    • For M2 Series modules: You can configure up to 2000 translations per port.

    • For M3 Series modules: You can configure up to 2000 translations per port.

Default Settings for VLANs

This table lists the default settings for VLAN parameters.

Table 2. Default VLAN Parameters

Parameters

Default

VLANs

Enabled

VLAN

VLAN1—A port is placed in VLAN1 when you configure it as a switch port.

VLAN ID

1

VLAN name

  • Default VLAN (VLAN1)—default

  • All other VLANs—VLAN vlan-id

VLAN state

Active

STP

Enabled; Rapid PVST+ is enabled

VTP

Disabled

VTP version

1

Configuring a VLAN


Note

See the Cisco Nexus 7000 Series NX-OS Interfaces Configuration Guide for information on assigning Layer 2 interfaces to VLANs (access or trunk ports). All interfaces are in VLAN1 by default.



Note

If you are familiar with the Cisco IOS CLI, be aware that the Cisco NX-OS commands for this feature might differ from the Cisco IOS commands that you would use.


Creating and Deleting a VLAN

You can create or delete all VLANs except the default VLAN and those VLANs that are internally allocated for use by the device.

Once a VLAN is created, it is automatically in the active state.


Note

When you delete a VLAN, ports associated to that VLAN become inactive. Therefore, no traffic flows and the packets are dropped. On trunk ports, the port remains open and the traffic from all other VLANs except the deleted VLAN continues to flow.


If you create a range of VLANs and some of these VLANs cannot be created, the software returns a message listing the failed VLANs, and all the other VLANs in the specified range are created.


Note

You can also create and delete VLANs in the VLAN configuration submode.


Before you begin

Ensure that you are in the correct VDC (or enter the switchto vdc command). You can repeat VLAN names and IDs in different VDCs, so you must confirm that you are working in the correct VDC.

Procedure

  Command or Action Purpose
Step 1

config t

Example:

switch# config t
switch(config)#

Enters global configuration mode.

Step 2

vlan {vlan-id | vlan-range}

Example:

switch(config)# vlan 5
switch(config-vlan)#

Creates a VLAN or a range or VLANs. If you enter a number that is already assigned to a VLAN, the device puts you into the VLAN configuration submode for that VLAN. If you enter a number that is assigned to an internally allocated VLAN, the system returns an error message. However, if you enter a range of VLANs and one or more of the specified VLANs is outside the range of internally allocated VLANs, the command takes effect on only those VLANs outside the range. The range is from 2 to 4094; VLAN1 is the default VLAN and cannot be created or deleted. You cannot create or delete those VLANs that are reserved for internal use.

Step 3

exit

Example:

switch(config-vlan)# exit
switch(config)#

Exits the VLAN mode.

Step 4

(Optional) show vlan

Example:

switch# show vlan
(Optional)

Displays information about the VLANs.

Step 5

(Optional) copy running-config startup-config

Example:

switch(config)# copy running-config startup-config
(Optional)

Copies the running configuration to the startup configuration.

Example

This example shows how to create a range of VLANs from 15 to 20:


switch# config t 
switch(config)# vlan 15-20
switch(config-vlan)# exit
switch(config)#

Entering the VLAN Configuration Submode

To configure or modify the VLAN for the following parameters, you must be in the VLAN configuration submode:

  • Name

  • State

  • Shut down

Before you begin

Ensure that you are in the correct VDC (or enter the switchto vdc command). You can repeat VLAN names and IDs in different VDCs, so you must confirm that you are working in the correct VDC.

Procedure

  Command or Action Purpose
Step 1

config t

Example:

switch# config t
switch(config)#

Enters global configuration mode.

Step 2

vlan {vlan-id | vlan-range}

Example:

switch(config)# vlan 5
switch(config-vlan)#

Places you into VLAN configuration submode. This submode allows you to name, set the state, disable, and shut down the VLAN or range of VLANs.

You cannot change any of these values for VLAN1 or the internally allocated VLANs.

Step 3

exit

Example:

switch(config-vlan)# exit
switch(config)#

Exits VLAN configuration mode.

Step 4

(Optional) show vlan

Example:

switch# show vlan
(Optional)

Displays information and status of VLANs.

Step 5

(Optional) copy running-config startup-config

Example:

switch(config)# copy running-config startup-config
(Optional)

Copies the running configuration to the startup configuration.

Example

This example shows how to enter and exit VLAN configuration submode:

switch# config t
switch(config)# vlan 15
switch(config-vlan)# exit
switch(config)#

Configuring a VLAN

To configure or modify a VLAN for the following parameters, you must be in VLAN configuration submode:

  • Name

  • State

  • Shut down


Note

You cannot create, delete, or modify the default VLAN or the internally allocated VLANs. Additionally, some of these parameters cannot be modified on some VLANs.


Before you begin

Ensure that you are in the correct VDC (or enter the switchto vdc command). VLAN names and IDs can be repeated in different VDCs, so you must confirm which VDC that you are working in.

Procedure

  Command or Action Purpose
Step 1

config t

Example:

switch# config t
switch(config)#

Enters global configuration mode.

Step 2

vlan {vlan-id | vlan-range}

Example:

switch(config)# vlan 5
switch(config-vlan)#

Places you into VLAN configuration submode. If the VLAN does not exist, the system creates the specified VLAN and then enters the VLAN configuration submode.

Step 3

name vlan-name

Example:

switch(config-vlan)# name accounting

Names the VLAN. You can enter up to 32 alphanumeric characters to name the VLAN. You cannot change the name of VLAN1 or the internally allocated VLANs. The default value is VLANxxxx where xxxx represents four numeric digits (including leading zeroes) equal to the VLAN ID number.

The system vlan long-name command allows you to enable VLAN names that have up to 128 characters.

Step 4

state {active | suspend}

Example:

switch(config-vlan)# state active

Sets the state of the VLAN to active or suspend. While the VLAN state is suspended, the ports associated with this VLAN become inactive, and that VLAN does not pass any traffic. The default state is active. You cannot suspend the state for the default VLAN or VLANs 1006 to 4094.

Step 5

no shutdown

Example:

switch(config-vlan)# no shutdown

Enables the VLAN. The default value is no shutdown (or enabled). You cannot shut down the default VLAN, VLAN1, or VLANs 1006 to 4094.

Step 6

exit

Example:

switch(config-vlan)# exit
switch(config)#

Exits VLAN configuration submode.

Step 7

(Optional) show vlan

Example:

switch# show vlan
(Optional)

Displays information about the VLANs.

Step 8

(Optional) show vtp status

Example:

switch# show vtp status
(Optional)

Displays information about the VLAN Trunking Protocol (VTP).

Step 9

(Optional) copy running-config startup-config

Example:

switch(config)# copy running-config startup-config
(Optional)

Copies the running configuration to the startup configuration.

Note 

Commands entered in VLAN configuration submode are immediately executed. Beginning with Cisco Release 5.1 for Nexus 7000 series devices, you must exit the VLAN configuration submode for configuration changes to take effect.

Example

This example shows how to configure optional parameters for VLAN 5:

switch# config t
switch(config)# vlan 5 
switch(config-vlan)# name accounting 
switch(config-vlan)# state active 
switch(config-vlan)# no shutdown 
switch(config-vlan)# exit 
switch(config)#

Changing the Range of Reserved VLANs

To change the range of reserved VLANs, you must be in global configuration mode. After entering this command, you must do the following tasks:
  • Enter the copy running-config startup-config command

  • Reload the device

Procedure

  Command or Action Purpose
Step 1

config t

Example:

switch# config t
switch(config)#

Enters global configuration mode.

Step 2

system vlan start-vlan reserve

Example:

switch(config)# system vlan 3968 reserve

Allows you to change the reserved VLAN range by specifying the starting VLAN ID for your desired range.

You can change the reserved VLANs to any other 128 contiguous VLAN ranges. When you reserve such a range, it frees up the range of VLANs that were allocated for internal use by default, and all of those VLANs are available for user configuration except for VLAN 4094. All VDCs inherit the new reserved range of VLANs.

Note 

To return to the default range of reserved VLANs (3968-4049 and 4094), you must enter the no system vlan start-vlan reserve command.

Step 3

copy running-config startup-config

Example:

switch(config)# copy running-config
startup-config

Copies the running configuration to the startup configuration.

Note 

You must enter this command if you change the reserved block.

Step 4

reload

Example:

switch(config)# reload

Reloads the software, and modifications to VLAN ranges become effective.

For more details about this command, see the Cisco Nexus 7000 Series NX-OS Fundamentals Configuration Guide, Release 6.x.

Step 5

(Optional) show system vlan reserved

Example:

switch(config)# show system vlan reserved
(Optional)

Displays the configured changes to the VLAN range.

Example

This example shows how to change the range of reserved VLANs:

switch# configuration terminal
switch(config)# system vlan 2000 reserve
This will delete all configs on vlans 2000-2081. Continue anyway? (y/n) [no] y
Note: After switch reload, VLANs 2000-2081 will be reserved for internal use.
      This requires copy running-config to startup-config before
      switch reload. Creating VLANs within this range is not allowed.
switch(config)#

Note

You must reload the device for this change to take effect.


Configuring a VLAN Before Creating the VLAN

Beginning with Cisco NX-OS Release 5.1(1), you can configure a VLAN before you create the VLAN. This procedure is used for IGMP snooping, VTP, and other configurations.

Note

The show vlan command does not display these VLANs unless you create the VLANs using the vlan command.


Procedure

  Command or Action Purpose
Step 1

config t

Example:

switch# config t
switch(config)#

Enters global configuration mode.

Step 2

vlan configuration {vlan-id}

Example:

switch(config)# vlan configuration 20
switch(config-vlan-config)#

Allows you to configure VLANs without actually creating them.

Example

This example shows how to configure a VLAN before creating it:
switch# config t
switch(config)# vlan configuration 20
switch(config-vlan-config)# 

Configuring VLAN Long-Name


Note

If VTP is enabled, it must be in transparent or in off mode. VTP cannot be in client or server mode. For more details about VTP, see the Configuring VTP chapter.


Procedure


Step 1

configure terminal

Example:

switch# configure terminal

Enters global configuration mode.

Step 2

system vlan long-name

Example:

switch(config)# system vlan long-name

Allows you to configure the length of VLAN names up to 128 characters.

Note 

Enabling or disabling the system vlan long-name command will trigger a system log message that will let you know if the VLAN long name is enabled or disabled.

If you try to enable or disable the system vlan long-name command, when it is already enabled or disabled, the system will throw error message. We recommend you view the status of the VLAN long-name knob before enabling or disabling this command.

Use the no form of this command to disable this feature.

Step 3

(Optional) copy running-config startup-config

Example:

switch(config)# copy running-config startup-config

Saves the change persistently through reboots and restarts by copying the running configuration to the startup configuration.

Step 4

show running-config | sec long-name

Example:

switch(config)# show running-config | sec long-name
Displays the VLAN long-name status information.
Note 

When you configure a VLAN name of more than 32 characters, the show vlan commands will show the output in mulitple lines with each line containing a maximum of 32 characters.


Example

This example shows how to configure VLAN long-names of up to 128 characters.
switch# configure terminal
switch(config)# system vlan long-name
!2001 Sep 29 02:24:11 N72-3 %$ VDC-1 %$ %VLAN_MGR-2-CRITICAL_MSG: VLAN long name is Enabled!
switch(config)# copy running config startup config
switch(config)# show running-config | sec long-name 
switch# configure terminal
switch(config)# vlan 2
switch(config-vlan)# name VLAN128Char000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002

switch(config-vlan)# exit
switch# show vlan id 2

VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
2 VLAN128Char000000000000000040000 active 
00000000000000000000000000000000 
00000000000000000000000000000000 
00000000000000000000000000000002 
.
.
.

The following example displays the error output if you try to configure a VLAN long name of more than 128 characters.

switch# system vlan long-name
switch(config)# vlan 2
switch(config-vlan)# name 129Char123456789000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000987654321CiscoBangalore

!% String exceeded max length of (128) at '^' marker.!
Switch(config-vlan)# exit

The following example displays the error output if you try to configure VLAN name ( more than 32 characters) without enabling the system vlan long- name command.

switch# configure terminal
switch(config)# vlan 2
switch(config-vlan)# name 33Char1234567890987CiscoBangalore
!ERROR: Long VLAN name is not enabled: Vlan name greater than 32 is not allowed!
Switch(config-vlan)# exit

Configuring VLAN Translation on a Trunk Port

You can configure VLAN translation between the ingress VLAN and a local VLAN on a port. The traffic arriving on the ingress VLAN maps to the local VLAN at the ingress of the trunk port and the traffic that is internally tagged with the translated VLAN ID is mapped back to the original VLAN ID before leaving the switch port.

Before you begin

  • Ensure that the physical or port channel on which you want to implement VLAN translation is configured as a Layer 2 trunk port.

  • Ensure that the translated VLANs are created on the switch and are also added to the Layer 2 trunk ports trunk-allowed VLAN vlan-list.

  • For FEX port-channel trunk interfaces, the last VLAN in the allowed VLAN list must be associated with a translated VLAN in one of the VLAN maps configured on the FEX fabric interface.

Procedure

  Command or Action Purpose
Step 1

switch# configure terminal

Enters global configuration mode.

Step 2

switch(config)# interface type port

Enters interface configuration mode.

Step 3

(Optional) switch(config-if)# [no] switchport vlan mapping enable

(Optional)

Enables VLAN translation on the switch port after VLAN translation is explicitly disabled. VLAN translation is enabled by default.

Note 

Use the no form of this command to disable VLAN translation.

Step 4

switch(config-if)# [no] switchport vlan mapping vlan-id translated-vlan-id

Translates a VLAN to another VLAN.

  • The range for both the vlan-id and translated-vlan-id arguments is from 1 to 4094.

  • When you configure a VLAN mapping between a VLAN and a (local) VLAN on a port, traffic arriving on the VLAN gets mapped or translated to the local VLAN at the ingress of the switch port, and the traffic internally tagged with the translated VLAN ID gets mapped to the original VLAN ID before leaving the switch port. This method of VLAN mapping is a two-way mapping.

Note 
Use the no form of this command to clear the mappings between a pair of VLANs.
Step 5

switch(config-if)# [no] switchport vlan translation all

Removes all VLAN translations configured on the interface.

Step 6

(Optional) switch(config-if)# copy running-config startup-config

(Optional)

Copies the running configuration to the startup configuration.

Note 

The VLAN translation configuration does not become effective until the switch port becomes an operational trunk port

Step 7

(Optional) switch(config-if)# show interface [if-identifier] vlan mapping

(Optional)

Displays VLAN mapping information for all interfaces or for the specified interface.

Example

This example shows how to configure VLAN translation between (the ingress) VLAN 10 and (the local) VLAN 100:

switch# config t
switch(config)# interface ethernet1/1  
switch(config-if)# switchport vlan mapping 10 100 
switch(config-if)# show interface ethernet1/1 vlan mapping

Interface eth1/1:
Original VLAN          Translated VLAN
------------------     ---------------
10                          100 

Verifying the VLAN Configuration

To display VLAN configuration information, perform one of the following tasks:

Command

Purpose

show running-config vlan vlan-id

Displays VLAN information.

show vlan [all-ports | brief | id vlan-id | name name | dot1q tag native]

Displays VLAN information.

show vlan summary

Displays a summary of VLAN information.

show vtp status

Displays VTP information.

show system vlan reserved

Displays system reserved VLAN range.

For information on the output of these commands, see the Cisco Nexus 7000 Series NX-OS Layer 2 Switching Command Reference.

Displaying and Clearing VLAN Statistics

To display VLAN configuration information, perform one of the following tasks:

Command

Purpose

clear vlan [id vlan-id] counters

Clears counters for all VLANs or for a specified VLAN.

show vlan counters

Displays information on Layer 2 packets in each VLAN.

Configuration Example for VLANs

The following example shows how to create and name a VLAN as well as how to make the state active and administratively up:

switch# configure terminal
switch(config)# vlan 10
switch(config-vlan)# name test
switch(config-vlan)# state active
switch(config-vlan)# no shutdown
switch(config-vlan)# exit
switch(config)# 

Additional References for VLANs

Related Documents

Related Topic

Document Title

Command reference

Cisco Nexus 7000 Series NX-OS Layer 2 Switching Command Reference

NX-OS Layer 2 switching configuration

Cisco Nexus 7000 Series NX-OS Layer 2 Switching Configuration Guide

Interfaces, VLAN interfaces, IP addressing, and port channels

Cisco Nexus 7000 Series NX-OS Interfaces Configuration Guide

Multicast routing

Cisco Nexus 7000 Series NX-OS Multicast Routing Configuration Guide

NX-OS fundamentals

Cisco Nexus 7000 Series NX-OS Fundamentals Configuration Guide

High availability

Cisco Nexus 7000 Series NX-OS High Availability and Redundancy Guide

System management

Cisco Nexus 7000 Series NX-OS System Management Configuration Guide

VDCs

Cisco Nexus 7000 Series NX-OS Virtual Device Context Configuration Guide

Licensing

Cisco NX-OS Licensing Guide

Release notes

Cisco Nexus 7000 Series NX-OS Release Notes

Standards

Standards

Title

No new or modified standards are supported by this feature, and support for existing standards has not been modified by this feature.

MIBs

MIBs

MIBs Link

CISCO-VLAN-MEMBERSHIP MIB:

  • vmMembership Table

  • MIBvmMembershipSummaryTable

  • MIBvmMembershipSummaryTable

To locate and download MIBs, go to the following URL: https://cfnng.cisco.com/mibs.

Feature History for Configuring VLANs

This table lists the release history for this feature.

Table 3. Feature History for Configuring VLANs

Feature Name

Releases

Feature Information

VLAN translation

6.2(6)

You can configure mapping between a pair of VLANs.

Configure VLAN long-name.

6.1(1)

You can configure VLAN long-names.

Dynamic system reserved VLAN range

5.2(1)

You can change the range of the system reserve VLANs.

Configure VLAN before creating the VLAN

5.1(1)

You can configure a VLAN before creating the VLAN.

No change

4.2(1)

--

VLAN Trunking Protocol

4.1(2)

The device now runs VTP in transparent mode.