This is a simple step-by-step guide to adding / assigning a vLAN to a vSwitch virtual machine network on VMware ESXi and vSphere 5, 5.5, and 6. Another way of putting it is adding a port group to a vSwitch. It is a pretty straight forward process, but if you’ve never done it before it can be a little confusing. We are going to create a Virtual Machine Port Group (network) that is assigned exclusively to a vLAN ID. This guide assumes you have already created the vLAN on your switch and configured a trunk port to your virtualized infrastructure.
First, go ahead and log into the vSphere Client. Once you have done so, navigate to Home > Inventory > Hosts and Clusters (if using vSphere). If you are logging directly into an ESXi server, you should already be where you need to be immediately upon logging in. Select your ESXi host in the left column, and then select the Configuration tab. Once you are on the Configuration page, select Networking. Select the Properties of the vSwitch you would like your vLAN to be assigned to. In my case, I’m selecting the properties of vSwitch0.
Now, we need to add a port group exclusive to the vLAN. Click on Add.
You will now need to select a connection type. Select Virtual Machine, then click Next.
Now you need to label you new port group and enter the vLAN ID. The name can be anything you like, but I suggest making it similar to your vLAN ID, so you know it’s associated with that particular vLAN. The vLAN ID needs to correspond to the vLAN ID you chose on your switch during configuration.
Go ahead and click next and you can review your changes.
Click Finish and you are all done. You can also go ahead and click Close on the vSwitch properties page. Now, when you go to assign a Virtual Machine Network to a virtual machine, you will have the option of selecting your new port group (network).
That’s all there is to it. If you have any questions, please feel free to ask in the questions below. Thanks!