Sometimes you need pass through Trunk to VMs on ESXi emvitonment. Ex: Nested ESXi with NSX.

To set a standard vSwitch portgroup to trunk mode:

  1. Edit host networking via the Virtual infrastructure Client.
  2. Navigate to Host > Configuration > Networking > vSwitch > Properties.
  3. Click Ports > Portgroup > Edit.
  4. Click the General tab.
  5. Set the VLAN ID to 4095. A VLAN ID of 4095 represents all trunked VLANs.
  6. Click OK.

To set a distributed vSwitch portgroup to trunk mode:

  1. Edit host networking via the Virtual infrastructure Client.
  2. Navigate to Home > Inventory > Networking.
  3. Right-click on the dvPortGroup and select Edit Settings.
  4. Within that dvPortGroup, go to Policies > VLAN.
  5. Set VLAN type to VLAN Trunking and specify a range of VLANs or specificy a list of VLANs to be passed to the Virtual machines connected to this portgroup.
    Note: To improve security, virtual Distributed Switches allow you to specify a range or selection of VLANs to trunk rather than allowing all VLANS via VLAN 4095.