vSwitch is an inbuilt software switch which allows the connection between the VM and from the VM to the external networks using the physical adaptors (vmnic) of the ESXi host. Each VM when brought up on ESXi host have a VNIC which connects to a particular port-group on the vSwitch (Port-groups define to which VLAN this VM connects)
The connectivity looks like below:
Traffic from the VM goes via VNIC and reaches a port-group on vSwitch. If traffic is for external network then vSwitch passes it on to vmnic. If traffic is destined for internal VM traffic is passed onto the relevant port-group where destination VM connects.
Related – Top VMware Interview Quetsions
A vSwitch also has special ports that the hosts and vCenter use to talk amongst themselves for traffics other than VM traffic. E.g. traffic flows handled by VMkernel ports are: Storage, vMotion, Management traffics.
Creating vSwitch Standard on ESXi host via vSphere Web Client
Step 1: Login to the vSphere web client and click on the ESXi host on which you want to add a new standard vSwitch. Select Configure and then under Networking click Virtual Switches. You shall be able to see an in-built standard virtual switch by default named vSwitch0.
Step 2: In order to add a new vSwitch click on Add networking and you will get following options and then click on Virtual Machine Port group for standard switch and Click Next.
Step 3: On the next window select whether you want to add this port group to existing standard switch or new standard switch. We will select a new standard switch, verify the MTU setting and click next.
Step 4: On the next window select the physical adaptors (vmnic) you want to assign to this vSwitch standard. In our case we don’t have any free physical adaptor in LAB hence we will create an internal only vSwitch. Click Next.
Step 5: On the next screen select the Network label for new switch and assign a VLAN to the port-group that we are creating. Click Next.
Step 6: On the last window review your vSwitch settings and click Finish.
As you click finish you will be able to see a new vSwitch added but there are no VMs attached to it yet and no VMNICs. VM (VCSA_LAB) attached as of now in lab is on vSwitch0 and it also has a vmnic attached and a single VMkernel port. Similar connectivity will be see if you attach a VM to this new switch and add vmnics to it.