VMware Cloud Community
gzhht
Contributor
Contributor

Find ways to temporarily disable a standard vSwitch

IHAC for some reason need to make all the VM's vnic in "disconnect" status for few second and then back to "connected", so need to find ways to disconnect all the vNICs in batch or disalbe the vSwitch. Seems vicfg-vswitch can't help on this. Any suggestion would be appreciated!

0 Kudos
3 Replies
DavoudTeimouri
Virtuoso
Virtuoso

Hi,

I think, it's possible by using PowerCLI.

You can use this command: Set-NetworkAdapter - vSphere PowerCLI Cmdlets Reference

-------------------------------------------------------------------------------------
Davoud Teimouri - https://www.teimouri.net - Twitter: @davoud_teimouri Facebook: https://www.facebook.com/teimouri.net/
0 Kudos
vfk
Expert
Expert

Powercli is your best solutions, just keep in mind if you are running vcenter as vm then you are basically shooting yourself in the foot, and also think about other core infrastructure servers.  vDS has option to disable individual ports on the vDS switch.

--- If you found this or any other answer helpful, please consider the use of the Helpful or Correct buttons to award points. vfk Systems Manager / Technical Architect VCP5-DCV, VCAP5-DCA, vExpert, ITILv3, CCNA, MCP
0 Kudos
admin
Immortal
Immortal

If you are ok with logging into the guest to disable/enable its vNICs, vmware-toolbox-cmd can help. This will be available only if you have installed VMware Tools in the Guest OS (Linux/Windows).


E.g. run below commands in the Guest OS:


~ # vmware-toolbox-cmd device disable Ethernet0 <or the vNICs you want to disconnect>

~ # vmware-toolbox-cmd device enable Ethernet0

To get the vNIC numbers do a device list.

VM configuration might need to be changed to allow access to the devices. Please refer to: vSphere Documentation Center
---

Or, from the ESXi host:

~ # vim-cmd vmsvc/device.connection <vmid> <device key> <connect/disconnect>


To get vmid:

vim-cmd vmsvc/getallvms

To get device key:

vim-cmd vmsvc/device.getdevice

0 Kudos