Configuring VLANs

Information About VLANs

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.

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. The software organizes these VLANs into ranges, and you use each range slightly differently.

For information about configuration limits, see the configuration limits documentation for the Cisco Nexus 3600 platform switches.

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.

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.

Creating, Deleting, and Modifying VLANs

VLANs are numbered from 1 to 4094. All configured ports belong to the default VLAN when you first bring up the switch. The default VLAN (VLAN1) uses only default values. 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 as well as 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 switch goes into the VLAN submode but does not create the same VLAN again.

Newly created VLANs remain unused until 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

  • Shutdown or not shutdown

When you delete a specified VLAN, the ports associated to that VLAN are shut down and no traffic flows. However, the system retains all the VLAN-to-port mapping for that VLAN, and when you re-enable, or recreate, the specified VLAN, the system automatically reinstates all the original ports to that VLAN.

Configuring a VLAN

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 switch. Once a VLAN is created, it is automatically in the active state.


Note


When you delete a VLAN, ports associated to that VLAN shut down. The traffic does not flow and the packets are dropped.


SUMMARY STEPS

  1. switch# configure terminal
  2. switch(config)# vlan {vlan-id | vlan-range}
  3. switch(config-vlan)# no vlan {vlan-id | vlan-range}

DETAILED STEPS

  Command or Action Purpose

Step 1

switch# configure terminal

Enters global configuration mode.

Step 2

switch(config)# vlan {vlan-id | vlan-range}

Creates a VLAN or a range of VLANs.

If you enter a number that is already assigned to a VLAN, the switch 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

switch(config-vlan)# no vlan {vlan-id | vlan-range}

Deletes the specified VLAN or range of VLANs and removes you from the VLAN configuration submode. You cannot delete VLAN1 or the internally allocated VLANs.

Example

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

switch# configure terminal
switch(config)# vlan 15-20
 

Note


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


Configuring a VLAN

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

  • Name

  • 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.


SUMMARY STEPS

  1. switch# configure terminal
  2. switch(config)# vlan {vlan-id | vlan-range}
  3. switch(config-vlan)# name vlan-name
  4. switch(config-vlan)# state {active | suspend}
  5. (Optional) switch(config-vlan)# no shutdown

DETAILED STEPS

  Command or Action Purpose

Step 1

switch# configure terminal

Enters global configuration mode.

Step 2

switch(config)# vlan {vlan-id | vlan-range}

Enters VLAN configuration submode. If the VLAN does not exist, the system first creates the specified VLAN.

Step 3

switch(config-vlan)# name vlan-name

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.

Step 4

switch(config-vlan)# state {active | suspend}

Sets the state of the VLAN to active or suspend. While the VLAN state is suspended, the ports associated with this VLAN are shut down, 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

(Optional) switch(config-vlan)# no shutdown

(Optional)

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

Example

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

switch# configure terminal
switch(config)# vlan 5
switch(config-vlan)# name accounting
switch(config-vlan)# state active
switch(config-vlan)# no shutdown
 

Adding Ports to a VLAN

After you have completed the configuration of a VLAN, assign ports to it.

SUMMARY STEPS

  1. switch# configure terminal
  2. switch(config)# interface {ethernet slot/port | port-channel number}
  3. switch(config-if)# switchport access vlan vlan-id

DETAILED STEPS

  Command or Action Purpose

Step 1

switch# configure terminal

Enters global configuration mode.

Step 2

switch(config)# interface {ethernet slot/port | port-channel number}

Specifies the interface to configure, and enters the interface configuration mode. The interface can be a physical Ethernet port or an EtherChannel.

Step 3

switch(config-if)# switchport access vlan vlan-id

Sets the access mode of the interface to the specified VLAN.

Example

This example shows how to configure an Ethernet interface to join VLAN 5:

switch# configure terminal
switch(config)# interface ethernet 1/13
switch(config-if)# switchport access vlan 5
 

Triggering the VLAN Membership Consistency Checker

You can manually trigger the VLAN Membership consistency checker to compare the hardware and software configuration of all ports in a VLAN and display the results. To manually trigger the VLAN Membership consistency checker and display the results, use the following command in any mode:

SUMMARY STEPS

  1. switch# show consistency-checker membership vlan vlan-id

DETAILED STEPS

Command or Action Purpose

switch# show consistency-checker membership vlan vlan-id

Starts a VLAN Membership consistency check on the member ports of vlan-id and displays the results.

Example

This example shows how to trigger a VLAN Membership consistency check and display the results:

switch# show consistency-checker membership vlan 2
Checks: Port membership of Vlan
Vlan  2 :
Consistency Check: PASSED
 Vlan:2, Hardware state consistent for:
   Ethernet1/18
   Ethernet1/20
   Ethernet1/29
   Ethernet1/30
   Ethernet1/31
   Ethernet1/32
   Ethernet1/33
   Ethernet1/34
   Ethernet1/35
   Ethernet1/36
   Ethernet1/37
   Ethernet1/38
   Ethernet1/39
   Ethernet1/4
   Ethernet1/40
   Ethernet1/41
   Ethernet1/42
   Ethernet1/43
   Ethernet1/44
   Ethernet1/45
   Ethernet1/46
   Ethernet1/47
   Ethernet1/48
   Ethernet1/5
   Ethernet1/6

Configuring a VLAN as a Routed SVI

You can configure a VLAN to be a routed switch virtual interface (SVI).

Before you begin

SUMMARY STEPS

  1. switch# configure terminal
  2. switch(config)# feature interface-vlan
  3. switch(config)# interface-vlan vlan-id
  4. switch(config-if)# copy running-config startup-config

DETAILED STEPS

  Command or Action Purpose

Step 1

switch# configure terminal

Enters global configuration mode.

Step 2

switch(config)# feature interface-vlan

Enables the creation of SVIs.

Step 3

switch(config)# interface-vlan vlan-id

Creates a VLAN interface (SVI) and enters interface configuration mode.

Step 4

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

Copies the running configuration to the startup configuration.

Example

This example shows how to configure a VLAN as a routed SVI:
switch# configure terminal
switch(config)# feature interface-vlan
switch(config)# interface vlan 5
switch(config-if)# copy running-config startup-config
switch(config-if)#

This example shows how to remove the routed SVI function from a VLAN:

switch# configure terminal
switch(config)# no interface vlan 5
switch(config-if)# copy running-config startup-config
switch(config-if)#

What to do next

You can configure routing protocols on this interface.

Configuring a VLAN as a Management SVI

You can configure a VLAN to be a management switch virtual interface (SVI).

SUMMARY STEPS

  1. switch# configure terminal
  2. switch(config)# feature interface-vlan
  3. switch(config)# interface-vlan vlan-id management
  4. switch(config-if)# copy running-config startup-config

DETAILED STEPS

  Command or Action Purpose

Step 1

switch# configure terminal

Enters global configuration mode.

Step 2

switch(config)# feature interface-vlan

Enables the creation of SVIs.

Step 3

switch(config)# interface-vlan vlan-id management

Creates a VLAN interface (SVI) and configures the SVI to be used for in-band management.

Step 4

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

Copies the running configuration to the startup configuration.

Example

This example shows how to configure a VLAN as a management SVI:
switch# configure terminal
switch(config)# feature interface-vlan
switch(config)# interface vlan 5
switch(config-if)# management
switch(config-if)# copy running-config startup-config
switch(config-if)#

This example shows how to remove the management function from an SVI:

switch# configure terminal
switch(config)# interface vlan 5
switch(config-if)# no management
switch(config-if)# copy running-config startup-config
switch(config-if)#

Verifying the VLAN Configuration

Use one of the following commands to verify the configuration:

Command

Purpose

switch# show running-config vlan [vlan_id | vlan_range]

Displays VLAN information.

switch# show vlan [brief | id [vlan_id | vlan_range] | name name | summary ]

Displays selected configuration information for the defined VLAN(s).