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 vCenter Server 6.x
VMware ESXi 6.x
VMware vCenter Server 7.x
VMware ESXi 7.x
VMware vCenter Server 8.x
VMware ESXi 8.x
Resolution
Changing the VLAN ID using the vSphere UI
Click the ESXi host and click the Configure tab.
Under Networking, select Virtual Standard Switches
In the right panel, click on the PortGroup to be modified.
Click on 3 dots next to PortGroup name & select Edit Settings
Under Properties select the appropriate value in the VLAN ID field (enter 0 for no VLAN).
Click OK.
To change the VLAN ID using the Esxi Host Client:
Log into the Esxi host client with root credentials in the browser like "https://esxi-host.domain.com"
In the left side under Networking, and select Virtual Standard Switch.
In the vSwitch topology diagram of the switch, click the name of the port group.
Click Edit under the topology diagram title.
In the Properties section, Configure VLAN tagging in the VLAN ID drop-down menu.
To change the VLAN ID at the Esxi host using the command line
Log into ESXi host as root via SSH, remote console, or at the physical console. For more information, see: Using ESXi Shell in ESXi
To view the current configuration of the virtual switches, run the command: esxcfg-vswitch -l The output appears similar to: Switch Name Num Ports Used Ports Configured Ports MTU Uplinks
vSwitch0 2990 3 128 8000 vmnic0
PortGroup Name VLAN ID Used Ports Uplinks
VM Network 110 0 vmnic0
Note: Your virtual switch and PortGroup names may be different.
Record the name of the virtual switch and PortGroup that you want to change.
To change the VLAN ID on a PortGroup, run the command:
esxcfg-vswitch -p "portgroup_name" -v VLAN_ID virtual_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 111 to VM Network (which resides on vSwitch0), you must run the command: esxcfg-vswitch -p "VM Network" -v 111 vSwitch0
To verify the new configuration, run the command: esxcfg-vswitch -l The output appears similar to:
Switch Name Num Ports Used Ports Configured Ports MTU Uplinks
vSwitch0 2990 3 128 8000 vmnic0
PortGroup Name VLAN ID Used Ports Uplinks
VM Network 111 0 vmnic0
To resolve connectivity and configuration issues, use these commands to link or unlink on Standard vSwitches:
To unlink an uplink: esxcfg-vswitch -U vmnic vSwitch