To run a DHCP Server or a Gateway on a VM on ESXi, you will need VLAN support.
In order to create VLAN interfaces on a VM, we need to attach its virtual NIC to a special Virtual Machine Port Group with VLAN 4095.
Before you begin, remember that you will need to configure the VM. On Linux an 802.1Q VLAN trunking driver is often loaded by default. Remember to select an E1000 Ethernet driver.
You can see this config in the following image:
Follow these steps to create the Port Group with VLAN 4095:
- Log in to the vSphere Client and select the host from the inventory panel.
- Go to Networks
- From the Actions pull-down, select Add Networking.
- Select "Virtual Machine Port Group for a Standard Switch" and click Next.
- Select "New standard switch" or select one of the existing vSwitches. The selected vSwitch to the service network, which holds the VLANs for the VMs, and click Next.
- In the Connection settings section, enter a Network label to identify the port group you are creating.
Note: The network label can contain up to 63 characters - For the VLAN ID, select All (4095)
- Click Next.
- After you determine that the vSwitch is configured correctly, click Finish.
This port group will be used when receiving DHCP tagged demands from deployed virtual machines.