# Configuring VLANs on VMware ESXi

This guide provides step-by-step instructions for configuring VLANs on VMware ESXi. You’ll learn how to create port groups, set VLAN IDs, and assign them to the VM running the Domotz Pro Collector. Each section breaks down the process to help you set up and verify your VLAN configuration with ease.

### **1. Log in to the ESXi Host Client**

To get started, access the ESXi Host Client through your web browser. Navigate to the host’s IP address or FQDN:

VMware ESXi Host Client Login Screen

1. Locate the VMware ESXi Host Client logo at the top of the screen.
2. Enter your username in the designated “username” field.
3. Enter your password in the “password” field below.
4. Click the blue “LOGIN” button to access the client.

Enter your login credentials to proceed.

### **2. Navigate to Networking > Port Groups**

Managing Port Groups in ESXi Host Client

1. In the Navigator panel on the left, select "Networking" under the "Host" category to view network settings.

2. In the main panel, make sure the "Port groups" tab is selected. This displays a list of available port groups.

3. To add a new port group, click on the "Add port group" button. Use this option to configure additional network segments.

4. The table below shows existing port groups with details such as Name, Active ports, VLAN ID, Type, associated vSwitch, and the number of VMs associated.

5. Review and manage port groups by selecting options under "Actions" for tasks like editing or removing groups.

Once logged in, locate the **Networking**section in the left-hand menu. From there Click on the **Port Groups** tab.

### **3. Create a new Port Group**

Click on **Add port group**

Dialog for adding a new port group.

1. Enter a name for the port group in the "Name" field.
2. Specify the "VLAN ID" by entering a number.
3. Select a virtual switch from the "Virtual switch" dropdown menu.
4. To configure security settings, click on "Security" to expand the options.
5. Click "ADD" to create the port group, or "CANCEL" to exit without saving changes.

Select the virtual switch where you’d like the port group to reside.
Specify the VLAN ID based on your requirements:

- **0**: For untagged traffic.
- Specific VLAN ID (**1–4094**): To assign a specific VLAN.
- **4095**: For TRUNK mode (accepts traffic for all VLANs).

Source: [https://knowledge.broadcom.com/external/article?legacyId=1004074](https://knowledge.broadcom.com/external/article?legacyId=1004074)

After completing these settings, click ADD to save your new port group. This structured approach ensures optimal VLAN configuration.

### **4. Double-Check VLAN Configuration**

To avoid misconfigurations, verify your setup:

- Confirm the VLAN ID for the port group under the virtual switch settings.
- Ensure that the physical switch ports are correctly configured to support the VLAN tagging requirements.

This step helps prevent connectivity issues.

### **5. Assign the new port group to the Domotz Pro collector VM**

To associate the newly created port group with the Domotz Pro Collector VM, you’ll need to add a network adapter to the VM. Ensure the VM is powered off before proceeding:

**a)** Navigate to the VM hosting the Domotz Pro Collector.

**b)** Click on Edit to modify the VM configuration.

**c)** Click Add Network Adapter to create a new NIC.

**d)** From the dropdown menu, select the Port Group you just created.

Adding a Network Adapter in ESXi Virtual Machine

1. Open the "Edit settings" window for the virtual machine.

2. Navigate to the "Virtual Hardware" tab and click on "Add network adapter."

3. A new entry titled "New Network Adapter" will appear in the hardware list.

4. In the "Port Group Name" dropdown, select the desired network.

5. Check the "Connect" box to enable the network adapter.

6. Click the "Save" button to apply the changes.

**e)** Click Save to apply the changes.

**f)** Finally, power on the VM to enable the new network adapter.

### **6. Configuring the VM to Use the New NIC**

If you are using the pre-built Domotz Pro Collector image (refer to the onboarding guide: [Domotz VMware ESXi Installation Guide](https://help.domotz.com/onboarding-guides/domotz-installation-vmware-esxi/)), follow these instructions to configure the NIC.

**a) Configuring Multiple NICs (Each Assigned to a VLAN)**

Configuring Network Adapters in a Virtual Machine

1. The first item is "Network Adapter 1," set to "VM Network." Ensure the "Connect" checkbox is selected to enable connectivity.

2. The second item is labeled "New Network Adapter," configured to "VLAN666." Ensure the "Connect" checkbox is selected to activate it.

3. The third item, also labeled "New Network Adapter," is configured to "VLAN87." Make sure the "Connect" checkbox is checked to establish connection.

For each adapter, ensure the correct network is selected from the dropdown menu and the "Connect" option is enabled for connectivity.

The pre-built image is set to use DHCP for all attached interfaces by default. The Netplan configuration file (**/etc/netplan/00-installer-config.yaml**) typically looks like this:

```
network:
    version: 2
    ethernets:
        all-en:
            match:
                name: "en*"
            dhcp4: true
            dhcp6: false
            accept-ra: false
        all-eth:
            match:
                name: "eth*"
            dhcp4: true
            dhcp6: false
            accept-ra: false
```

Each NIC will request an IP address via DHCP for the respective VLAN.

**b) Configuring the NIC with a port group in Trunk mode (port group VLAN ID 4095)**

Configuring a Network Adapter Connection

1. Locate the "Network Adapter 1" section on the interface.
2. Use the dropdown menu to select an option labeled "Trunk Group."
3. Ensure the "Connect" checkbox next to the dropdown is checked to establish the connection.

If the port group is set to Trunk mode (VLAN ID 4095), you need to configure VLANs at the operating system level using Netplan. Refer to the Help Center article [How to Monitor VLANs on Ubuntu Linux](https://help.domotz.com/monitoring-management/how-to-monitor-vlans-on-linux/) for a detailed setup guide.
