Is it possible, using Hyper-V 2012R2, to construct a Virtual Switch internal to Hyper-V (no external connectivity necessary or desired), where one switch participant (VM 0 in the diagram below) has a trunk interface, and the remaining VMs (VM 1 ... VM n in the diagram below) each have access ports to the virtual switch tagged with the a particular VLAN ID.
_______________________________________________________ | Hyper-V host | | | | _____ _____ ______ ______ | | | VM0 | | VM1 | | VM 2 | ... | VM n | | | | | | | | | | | | | |_____| |_____| |______| |______| | | |:| eth0 | eth0 | eth0 | eth0 | | |:| trunk | vlan 1 | vlan 2 | vlan 3 | | |:| | | | | | ================================================= | | Virtual Switch | |_______________________________________________________|
For instance, untagged packets leaving the
eth0 interface of VM2 would be tagged with VLAN tag 2 as they pass to the virtual switch. They would then egress through the the trunk port toward VM0, where they would arrive in the the VM through
eth0 of that VM, and (if this was a linux VM) be readable on
eth0.2, i.e. the VLAN tagging would be evident to VM0. Similarly traffic egressing
eth0 of VM0 tagged with VLAN tag 2 would enter the virtual switch with that tag in place, and the tag would be stripped prior to sending it to VM2, where it would appear on VM's
eth0 interface untagged.
If so, how is this tagging achieved? I'm not a Hyper-V expert, and the only documentation I can find talks about the whole of the switch being in trunk mode or access mode. Clearly the switch needs to carry VLAN tags, but I need to put different ports into trunk or access mode. Is this possible without an external interface? I also neither want or need connectivity to the Hyper-V parent partition.
I realise I could have one virtual switch per VLAN in the above configuration, but don't want to do that as VM0 would have to have a large number of network interfaces and this would use many virtual switches.
This config works fine on VMware and Linux, and isn't as odd as you might think.
The line drawing is terrible, apologies.
I am quite prepared to do this programatically rather than through the GUI if that is necessary.