Tag Archives: ESX vSwitch

Add or remove the vmnic on the vSwitch to recover the network connection

Have you ever accidentally removed your vmnic from your only vSwitch? Or added a vmnic to your vSwitch assigning an IP from different network? Both ways would cause your current network connection with ESX down. What is the workaround?

First, you need to use KVM or iLO to remotely login to your server screen. If you don’t have that, you have to connect monitor and keyboard to your server.

Next, let’s use the ESX commands to add or remove the vmnic from vSwitch.

ESX has an useful command “esxcfg-vswitch” which can assign, remove and modify the vSwitches with their port group, service console and vmnic.

If you deleted the vmnic, to add it back to a vSwitch

#esxcfg-vswitch -L vmnicN vSwitchN (vmicN is the vmnic number and vSwitchN is the vSwitch number)

Or if you want to remove an unnecessary vmnic from a vSwitch, use the command

#esxcfg-vswitch -U vmnicN vSwitchN

Sometimes we also need to add an uplink to a particular port group under a vSwitch

#esxcfg-vswitch -M vmnicN vswitchN -p PortGroupN (PortGroupN is the port group number)

Take note that the PortGoupN can also be a service console.

After such simple steps, you are happy to see your connection is back and all GUI operation can continue again.