Forum Discussion
Hyper-V Core - Setting up a VLAN
Yes, you can set up VLANs on Hyper-V Core 2019 using PowerShell, and your existing VMs can be grouped into a private network with internet access. You don’t need to upgrade to a full GUI OS to achieve this:
1. Create a Virtual Switch
Use PowerShell to create an external virtual switch that supports VLAN tagging:
New-VMSwitch -Name "VLANSwitch" -NetAdapterName "Ethernet" -AllowManagementOS $true
• Replace "Ethernet" with your actual physical NIC name.
• This switch will allow VMs to communicate externally and with each other.
2. Assign VLAN IDs to VM network adapters
For each VM you want to isolate into a VLAN:
Set-VMNetworkAdapterVlan -VMName "VM1" -Access -VlanId 100
Set-VMNetworkAdapterVlan -VMName "VM2" -Access -VlanId 100
...
• This puts all 5 VMs into VLAN 100.
• Use different VLAN IDs for other groups.
3. Enable internet access
To allow internet access:
• Ensure the physical switch port connected to your Hyper-V host is configured as a trunk port.
• Allow VLAN 100 on that trunk.
• Configure NAT or use a virtual router VM (e.g., pfSense) to route traffic from VLAN 100 to the internet.
Hi Kidd_Ip,
It seems i lost my last message in trying to respond. Sorry if this is a repeat.
Thanks for the comprehensive resposnse. I will try this soon.
In addition to the above can you advise how one manages these guest VMs remotely once these guest VMs are on there own private network with access to the internat? can i still use a remote Hyper-V manager to access the guest VMs?
I also dont know how to set a 'switch' (I assume this is the network interface of the Hyper-V host) to a Trunk port. Any resource on how to do this? Also what do i need to set the NAT as in your last bullet point above?
Lastly, Please be advised i want to perform this task on Hyper-V snaphots. Not the original install of the VM.
Regards,
Barry