VLAN Access and Layer 2 switching
Virtual Switch (ESX/ESXi) configuration to connect to VLAN switch port
Physical Switch Configuration (Cisco, HP, DELL, etc)
- Physical switch Mode Access (Layer2)
- Switch port access VLAN tagging (ID)
- Define VLAN interface
- Assign IP range to VLAN interface
- VLAN routing may be required or VLAN Isolation – (refer to VLAN layer 3 routing Article)
These commands are applied on Cisco IOS to configure switch port for VLAN access:
interface GigabitEthernet1/15
switchport ( Configures the LAN port for Layer 2 switching)
switchport access vlan vlan_ID ( The value can be 1 through 4094, except reserved VLANs)
switchport mode access ( Configures the port to be an access port to prevent trunk negotiation delays)
spanning-tree portfast ( Configure port-fast for initial STP delay)
This image is a sample EST topology:
Configuration within the vSphere/VMware Infrastructure Client or vSphere Web Client
To configure this within the vSphere/VMware Infrastructure Client:
-
Highlight the ESXi/ESX Server host.
- Click Configuration > Networking > Properties.
- Highlight the virtual switch in the Ports tab.
- Click Edit.
- Click the General tab.
- Type a value of 0 or NONE in the VLAN ID field. This indicates that VLAN Tagging is off.
- Click the NIC Teaming tab.
- From the Load Balancing dropdown, choose Route based on originating virtual port ID
-
Verify that there is at least one network adapter listed under ActiveAdapters
To configure within the vSphere Web Client.
- In the vSphere Web Client, navigate to the host.
- On Manage tab, click Networking
- Click Virtual Switches in the left panel and click the virtual switch that requires a change in its load balancing policy.
- Click Edit Setting > Teaming and Failover.
- From the Load Balancing dropdown, select Route based on originating virtual port ID.
- Click OK.
To perform VLAN configuration and verification via the command line:
-
Run the command:
esxcfg-vswitch –l
The results appear similar to:
Switch Name Num Ports Used Ports Configured Ports MTU Uplinks
vSwitch0 64 5 64 1500 vmnic3,vmnic1
PortGroup Name VLAN ID Used Ports Uplinks
VM Network 0 0 vmnic1,vmnic3
Service Console 0 1 vmnic1,vmnic3
Switch Name Num Ports Used Ports Configured Ports MTU Uplinks
vSwitch2 64 8 64 1500 vmnic2,vmnic0
PortGroup Name VLAN ID Used Ports Uplinks
VMkernel 0 1 vmnic0,vmnic2
Service Console 2 0 1 vmnic0,vmnic2
Production 0 2 vmnic0,vmnic2
To retrieve VLAN information from a vmnic
, follow the steps below:
-
Enable VLAN statistics for the specific vmnic
:
esxcli network nic vlan stats set -e true -n vmnicX
Replace vmnicX
with the appropriate vmnic
identifier (e.g., vmnic0
, vmnic1
).
-
Retrieve the VLAN statistics for the selected vmnic
:
esxcli network nic vlan stats get -n vmnicX
This command will display the VLAN statistics for the specified vmnic
.
Please note: The data provided by these statistics may not be completely accurate in all scenarios.