I have ESXI hypervisor installed and running 4 VMs. I want to create a specific topology between these 4 VMs. So I need to create virutal swith and add the virtual network interface of these VMs to these virtual switch. I am planning to automate this and hence I'm using the VMware vSphere CLI command line interface. But I am not able to find the CLI command for adding the virtual network interface to vSwitch. Does it only support adding physical interface?
I am able to do the same through the vSphere client UI.
esxcfg-vmknic –a –i 192.168.28.105 –n 255.255.255.0 PortGroupName
Also, will this help:
This site has a whole bunch of script:
Thanks for your reply.
My query was how to Link a virtual Network interface of a VM to a vswitch. Is there a option to provide the virtual network interface in the below command?
vicfg-vswitch <conn_options> -L <physical adapter name> <vswitch name>
Lets say that I have ESXI server with 2 VMs - VM1 & VM2. I want to connect the VM1's virtual network interface eth1 with VM2's virtual network interface eth1 through CLI.
I can do this connection with VSphere client UI like this - I will go to the VM1 machine's eth1 and give the network label as vswitch1. Similarly I can do the same for VM2 machines eth1. I want an equivalent CLI command to do this.
Can someone help me to do this?
Will this help:
I found this example in Scott Lowe's book.
vicfg-vswitch –A VLAN31-Finance vSwitch2 --vihost esx01.vmwarelab.net
Will this work for you?