VLANs in VMware Workstation

VLANs in VMware Workstation

Install and configure Hyper-V using PowerShell

(Your computer must be capable of hardware virtualization and set in BIOS)

#Open Powershell As Administrator

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-All

Enable-WindowsOptionalFeature -Online -FeatureName HypervisorPlatform

#reboot

#find the network adapter you want to attach the VLAN’s

Get-NetAdapter -Physical

Create a new VMSwitch

(normally the VMSwitch is for VMs but the -AllowManagementOS option allows the OS to interact)

New-VMSwitch -name ExternalSwitch  -NetAdapterName Ethernet -AllowManagementOS $true

Add a VM VLAN adapter

(Remember an access port doesn’t need the traffic to be tagged but it will be tagged when it hits the VLAN on the VMSwitch).

Add-VMNetworkAdapter -ManagementOS -Name “VLAN1” -SwitchName “ExternalSwitch” -Passthru | Set-VMNetworkAdapterVlan -Access -VlanId 1

(Remember an access port doesn’t need the traffic to be tagged but it will be tagged when it hits the VLAN on the VMSwitch).

Add-VMNetworkAdapter -ManagementOS -Name “TRUNK1” -SwitchName “ExternalSwitch” -Passthru | Set-VMNetworkAdapterVlan -Trunk -NativeVlanId 0 -AllowedVlanIdList “10,4,8,6,11,12”

Get list of management VM VLAN adapters

Get-VMNetworkAdapterVlan -ManagementOS

Enable Jumbo Frames

(If required)

Open network adapter control panel ncpa.cpl

Right click the physical adapter e.g. Ethernet 2 and click Configure

Select Advanced > Jumbo Packet > 9014 Bytes and click OK

Repeat this for the EXTERNALSWITCH / VLAN / TRUNK adapters

(REMEMBER JUMBO FRAMES NEEDS TO BE ENABLED IN THE ENTIRE NETWORK CHAIN)

Install VMware Workstation

Use all the default installation parameters install and reboot.

Setup Virtual Network Editor

Use PowerShell to find the InterfaceDescription names

Get-NetAdapter

In VMware Workstation Pro go to Edit > Virtual Network Editor and click change settings

Select the VMnet0 and Bridge to an unused adapter and click Apply

Now Click “Add Network” and create a new network adapter e.g. VMnet2 and click OK

Select the VMnet1 adapter and click rename enter VLAN1 and click OK

Select the VLAN1 adapter and click bridged then find the network adapter with the PowerShell InterfaceDescription of the VLAN1 (in my case the is “Hyper-V Virtual Ethernet Adapter #2”) select from Bridged to: drop down and click OK

Do the same for the TRUNK or any other VLAN’s

Leave a Reply

Your email address will not be published. Required fields are marked *