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 changing VLAN IDs for a virtual switch portgroup.

Note: Making changes to management VMkernel in ESXi from either the vSphere Client or an SSH session may cause the host to lose management network connectivity due to the access issue with network connectivity or the associated portgroup.
When working on management VMkernel port groups, 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.

Environment

VMware vCenter Server
VMware ESXi

Resolution

Changing the VLAN ID using the vSphere UI

  1. Click the ESXi host and click the Configure tab.
  2. Under Networking, select Virtual Switches.
  3. On the Virtual Switches field, select the Standard Switch.
  4. In the right panel, click on the PortGroup to be modified.
  5. Click on 3 dots next to PortGroup name & select Edit Settings.
  6. Under Properties select the appropriate value in the VLAN ID field (enter 0 for no VLAN).
  7. Click OK.

To change the VLAN ID using the ESXi Host Client:

  1. Log into the ESXi host client with root credentials in the browser like "https://<host_FQDN>"
  2. Click on Networking left side, it will show the switches on the right hand panel.
  3. Click the Standard switch
  4. In the vSwitch topology diagram of the switch, click the name of the port group.
  5. Click Edit Setting on the Port Group.
  6. Change the VLAN ID (VLAN 0 will use the native VLAN on the physical network).

 

To change the VLAN ID at the ESXi host using the command line :-

  1. Log into ESXi host as root via SSH, remote console, or at the physical console.
    For more information, refer Using ESXi Shell in ESXi
  2. To view the current configuration of the virtual switches, run the command from ESXi host root shell:
    esxcfg-vswitch -l

    The output appears similar to:
  3. Record the name of the virtual switch and PortGroup.
  4. To change the VLAN ID on a PortGroup, run the command from ESXi ssh session.
    esxcfg-vswitch -p <portgroup_name> -v VLAN_ID <virtual_switch_name>
  • For example, to add a VLAN ID of 111 to the port group "VM Network" (which resides on vSwitch0), run the command from ESXi host root shell:
    esxcfg-vswitch -p "VM Network" -v 111 vSwitch0

Additional Information