Configuring VLAN on a vSwitch standard portgroup
search cancel

Configuring VLAN on a vSwitch standard portgroup

book

Article ID: 311057

calendar_today

Updated On:

Products

VMware vCenter Server VMware vSphere ESXi

Issue/Introduction

This article provides information on adding and removing VLAN IDs to and from a portgroup.

Note: Making changes management VMkernel in ESXi from either the vSphere Client or an SSH session may cause the host to lose management network connectivity. When working on management VMkernel portgroups, it is best to use a remote console (such as ILO, DRAC, or an equivalent), or to work at the physical console of the server.

Symptoms:
  • Loss of network connectivity to and from the ESXi/ESX host
  • Loss of connectivity to associated portgroups


Environment

VMware ESX 4.0.x
VMware ESXi 4.0.x Installable
VMware vCenter Server 4.1.x
VMware vSphere ESXi 6.0
VMware vCenter Server 6.0.x
VMware ESXi 3.5.x Installable
VMware vCenter Server 5.5.x
VMware ESX Server 3.0.x
VMware ESXi 3.5.x Embedded
VMware ESXi 4.0.x Embedded
VMware vSphere ESXi 5.0
VMware vSphere ESXi 5.5
VMware vSphere ESXi 6.5
VMware vCenter Server 5.1.x
VMware vCenter Server 5.0.x
VMware vCenter Server 4.0.x
VMware ESX 4.1.x
VMware vCenter Server 6.5.x
VMware ESXi 4.1.x Embedded
VMware ESX Server 3.5.x
VMware ESXi 4.1.x Installable
VMware VirtualCenter 2.5.x
VMware vSphere ESXi 5.1
VMware VirtualCenter 2.0.x

Resolution

Changing the VLAN ID using the vSphere Client or VMware Infrastructure Client

To change the VLAN ID using the vSphere Client or VMware Infrastructure Client:
  1. Click the ESXi/ESX host and click the Configuration tab.
  2. Click the Networking link.
  3. Click Properties next to the virtual switch that serves the portgroup to be modified.
  4. Click the portgroup in the list and click Edit.
  5. Enter the appropriate value in the VLAN ID field (enter 0 for no VLAN).
  6. Click OK.
To change the VLAN ID using the vSphere Web Client:
 
  1. In the vSphere Web Client, navigate to the host.
  2. On the Manage tab, click Networking, and select Virtual switches.
  3. Select a standard switch from the list.
  4. In the topology diagram of the switch, click the name of the port group.
  5. Click Edit under the topology diagram title.
  6. In the Properties section, Configure VLAN tagging in the VLAN ID drop-down menu.

Changing the VLAN ID at the ESXi/ESX host using the command line

To change the VLAN ID at the ESXi/ESX host using the command line:
 
  1. Log into ESXi host as root via SSH, remote console, or at the physical console.

    For more information, see:
     
  2. To view the current configuration of the virtual switches, run the command:

    [root@server root]# esxcfg-vswitch -l

    The output appears similar to:

    Switch Name Num Ports Used Ports Configured Ports Uplinks
    vSwitch0 32 4 32 vmnic0

    PortGroup Name Internal ID VLAN ID Used Ports Uplinks
    VM Network 0 portgroup1 0 0 vmnic0
    Service Console portgroup0 0 1 vmnic0

    Switch Name Num Ports Used Ports Configured Ports Uplinks
    vSwitch1 64 2 64 vmnic1

    PortGroup Name Internal ID VLAN ID Used Ports Uplinks
    VM Network 1 portgroup19 0 0 vmnic1


    Note: Your virtual switch and portgroup names may be different.
     
  3. Record the name of the virtual switch and portgroup that you want to change.
  4. To change the VLAN ID on a portgroup, run the command:

    [root@server root]# esxcfg-vswitch -p "portgroup_name" -v VLAN_IDvirtual_switch_name

    Where portgroup_name is the name of your portgroup, and virtual_switch_name is the name of your virtual switch.

    For example, using the configuration above, to add a VLAN ID of 10 to VM Network 1 (which resides on vSwitch1), you must run the command:

    [root@server root]# esxcfg-vswitch -p "VM Network 1" -v 10 vSwitch1
     
  5. To verify the new configuration, run the command:

    [root@server root]# esxcfg-vswitch -l

    The output appears similar to:

    Switch Name Num Ports Used Ports Configured Ports Uplinks
    vSwitch1 64 2 64 vmnic1

    PortGroup Name Internal ID VLAN ID Used Ports Uplinks
    VM Network 1 portgroup19 10 0 vmnic1

     
  6. To resolve connectivity and configuration issues, use these commands to link or unlink the vmnic on standard vSwitches:
     
    • To unlink an uplink:

      esxcfg-vswitch -U vmnic vSwitch
       
    • To add an uplink:

      esxcfg-vswitch -L vmnic vSwitch


Additional Information

For related information, see Sample configuration of virtual switch VLAN tagging (VST Mode) (1004074).
Configuring vSwitch or vNetwork Distributed Switch from the command line in ESXi/ESX
Using Tech Support Mode in ESXi 4.1, ESXi 5.x, and ESXi 6.x
Using ESXi Shell in ESXi 5.x and 6.x
Configurar uma VLAN em um grupo de portas
Configuración de una VLAN en un portgroup
在端口组上配置 VLAN
ポートグループ上での VLAN