Verifying Allowed VLAN from TOR Switches to ESXi Host Using CLI

This tutorial will show you how to Verify the VLAN trunk on ESXi Host using CLI - SSH. 

Most of the environment Network and Compute are managed by a different team. If there is any new deployment of Compute cluster or addition of VLAN in the existing compute resources. Compute team will share requirements. The VLANs that are allowed on the trunk link which is directly connected to servers' physical port -> TOR switches.  In some cases, the network team forgets to add the new VLAN on a specific physical port. These human errors may lead major impact on production. 

The role of the VMware Administrator makes sure that the allowed VLANs are spanned across the physical ports of the ESXi hosts.

Verify ESXi Host VLAN Trunk Using CLI

VLAN Trunk Verify thru CLI

Step 1: Using SSH you can verify the VLAN trunk on ESXi Host.

Note: Use a Privilege account to login into ESXi Host and execute the commands mentioned in step 2.

Step 2: In the VMware vSphere ESXi Shell / PUTTY, run this command.

!Command to list the ESXi Physical Adapter

esxcli network nic list

!Command to Enable VLAN Stats for vmnic0 and vmnic1

esxcli network nic vlan stats set -e true -n vmnic0

esxcli network nic vlan stats set -e true -n vmnic1

!Command to get allowed VLANs from the physical layer to ESXi host for vmnic0 and vmnic1

esxcli network nic vlan stats get -n vmnic0 | grep -E VLAN

esxcli network nic vlan stats get -n vmnic1 | grep -E VLAN 

!Command to Disable VLAN Stats for vmnic0 and vmnic1

esxcli network nic vlan stats set -e false -n vmnic0

esxcli network nic vlan stats set -e false -n vmnic1

Note: Based on your esxcli network nic list output replace the vmnic0 and vmnic1 on the command based on your output. Some infra use vmnic1 and vmnic4 as an uplinks

Verification Command Output:

esxi host VLAN trunk verification command

esxi host VLAN trunk verification command

Note: 

Network Switch - CDP or LLDP Discovery Protocol type should be enabled for the UPlinks.

ESXi Host - Make sure your Distributed Virtual Switch [DVS] Discovery Protocol Operation should be in the Listen State. TOR Switches - if it's Cisco choose Type: Cisco Discovery Protocol, Other vendors choose Type: Link Layer Discovery Protocol.

Output: Distributed Switch Configuration

Distributed Switch Configuration

#ESXi VLAN Trunk Validation
#ESXi VLAN Trunk Verification
#Verify ESXi Host VLAN Trunk
#Trunk validation between ESXi host and TOR Switches
#esxcli commands


I hope this information is useful for you. Please forgive any typos or incomplete sentences.

Thanks for Visiting vNetes.com

Post a Comment (0)
Previous Post Next Post