Normally people want to migrate from virtual standard switches to distributed switches. I am a huge fan of the distributed switch and feel it should be used everywhere. The distributed switch becomes a challenge when you want to migrate hosts to a new vCenter. I have seen a lot of migrations to new vCenters via detaching the ESXi hosts and connecting to the new vCenter. This process works great assuming you are not using the distributed switch. Removing or working with VM’s on a ghosted VDS is a real challenge. So remove it before you migrate to a new vCenter.
In this multi-article solution I’ll provide some steps to migrate off a VDS to a VSS.
- Article 1: Creating a VSS and migrating the virtual machines
- Article 2: Migrating the host off the VDS
- Article 3: Migrating the host to a new vCenter and back into the distributed switch
Article 2: Migrating the host off the VDS. In the last article we moved all the virtual machines off the VDS to a VSS. We now need to migrate the vMotion and management off the VDS to a VSS. This step will cause interruption to the management of a ESXi host. Virtual machines will not be interrupted but the management / will be. You must have console access to the ESXi host for this to work. Steps at a glance:
- Confirm that a switch port exists for management and vMotion
- Remove vMotion, etc.. from VDS and add to VSS
- Remove management from VDS and add to VSS
- Confirm settings
Confirm that a switch port exists for management and vMotion
Before you begin examine the VSS to confirm that management and vMotion port groups were created correctly by Article 1's script. Once your sure the VLAN settings for the port group are correct then you can move to the next step. You may want to confirm your host isolation settings it’s possible these steps will cause a HA failure if you take too long to switch over and don’t have independent datastore networking. Best practice would be to disable HA or switch to leave powered on isolation response.
Remove vMotion, etc.. from VDS and add to VSS
Login to the ESXi host via console and ssh. (Comments are preceded with #)
#use the following command to identify virtual adapters on your dvs
esxcfg-vswitch -l
# sample output from my home lab
DVS Name Num Ports Used Ports Configured Ports MTU Uplinks
dvSwitch 1792 7 512 1600 vmnic1
DVPort ID In Use Client
675 0
676 1 vmnic1
677 0
678 0
679 1 vmk0
268 1 vmk1
139 1 vmk2
# We can see we have three virtual adapters on our host use the following command to identify their use and IP addresses
esxcfg-vmknic -l
#Sample output from my home lab cut out some details to make it more readable
Interface Port Group/DVPort IP Family IP Address
vmk0 679 IPv4 192.168.10.16
vmk1 268 IPv4 192.168.10.26
vmk2 139 IPv4 192.168.10.22
Align you vmk# with vCenter to identify which adapter provides the function (vmk0 management, vmk1 vMotion, vmk2 FT)
# We can now move all adapter other than management which in my case is vmk0 #we will start with vmk1 on dvSwitch on port 268
esxcfg-vmknic -d -v 268 -s "dvSwitch"
# Then add to vSwitch0 vmk1
esxcfg-vmknic -a -i 192.168.10.26 -n 255.255.255.0 -p PG-vMotion
Remove FT
esxcfg-vmknic -d -v 139 -s "dvSwitch"
esxcfg-vmknic -a -i 192.168.10.22 -n 255.255.255.0 -p PG-FT
Remove management from VDS and add to VSS
Remove management (this stage will interrupt management access to ESXi host – make sure you have console access) You might want to pretype the add command in the console before you execute the remove. If you are having trouble getting the shell on a ESXi host do the following:
You will need to login to the console go to troubleshooting options -> Enable ESXi Shell
Press Alt-Cntr-F1 to enter shell and login
Remove management:
esxcfg-vmknic -d -v 679 -s "dvSwitch"
Add management to VSS:
esxcfg-vmknic -a -i 192.168.10.16 -n 255.255.255.0 -p PG-Mgmt
Confirm settings
Ping the host to ensure networking has returned to management. Ensure the host returns to vCenter by waiting 2 minutes. After you move the host to a new vCenter you can remove via:
Go to the host in vCenter and select dvs it should provide a remove button.