configuring VLANs through the command line interface

with thanks to Michael Brophy for documenting this.

Create a new switch called GuestVirtualSwitch

esxcfg-vswitch -a GuestVirtualSwitch 

Link the new switch with a NIC

esxcfg-vswitch –Lvmnic3 GuestVirtualSwitch 

Add a port group to the switch called VLANxx (repeat for each VLAN/Subnet assigned to you)

esxcfg-vswitch –v64 –pVLAN64 GuestVirtualSwitch                                                                       

Assign a VLAN ID to a port group

 
esxcfg-vswitch –v64 –pVLAN64 GuestVirtualSwitch 

On the Cisco Switch

 
ESXi server VMNIC3 is cabled to port 15 on the switch 
 description *** VMWare UCLAB-VMWare02 Lab Access *** 
 switchport trunk encapsulation dot1q 
 switchport mode trunk 
 switchport nonegotiate 

Create the VLANS, assign an IP address and no shut

interface Vlan64 
 ip address 192.168.64.1 255.255.255.0 
 no shut