I am trying to test a VLAN-related networking issue, so I thought that firing up a couple virtual machines would be the easiest and cleanest method to test the problem. On the vSphere server I created a new vSwitch with no adapters bound, then created a new VM Network with VLAN tag 0 (disabled.)
I created two VMs and put those VMs on the new VM Network. They can talk to each other so long as VLAN tagging is not involved, but as soon as I assign their interfaces to a specific VLAN inside the operating system, they cannot communicate on the VLAN.
It appears that vSphere is stripping the VLAN tags somehow. Does anyone know if there's a way to make vSphere NOT strip VLANs it's not expecting at the vSwitch?
You need to check this VMware KB about VM VLAN Tagging Mode. This explains what to do on ESX 3.X but applies to 4 and 5 too.
Basically you need to enable trunk mode on the vSwitch by using VLAN ID 4095 to let your guests do the tagging.