Building a VMware vSphere Virtual Lab with VMware Fusion - Part 7: Creating a Distributed Switch and Migrating Port groups
This is the seventh part in a series of tutorials on how to build a VMware vSphere Virtual Lab on a Mac with VMware Fusion. In this tutorial, we'll create a vSphere Distributed Switch and migrate port groups from a standard vSwitch to it.
In the last tutorial, we created a new VMkernel port group for vMotion traffic and did some test live migrations. In this tutorial, we’ll convert our standard vSwitch to a vSphere Distributed Switch and enable Network I/O Control so that iSCSI and vMotion traffic does not use up all the available bandwidth.
Ideally you should have read the previous tutorials in the series before following the steps in this tutorial.
- Part 1: Installing ESXi
- Part 2: Deploy and Configure a pfSense VM
- Part 3: Deploying vCenter Server Appliance
- Part 4: Adding ESXi Hosts to a Cluster in vCenter
- Part 5: Create a Ubuntu iSCSI Target and Configure Multipathing
- Part 6: Create VMkernel port group for vMotion and enable DRS
After completing the steps in the previous tutorials, you will be at a point where you have:
- Three ESXi 6.7 VMs running on VMware Fusion*.
- The first ESXi VM contains a pfSense firewall VM with built in DNS Resolver.
- The first ESXi VM also contains the vCenter Server Appliance.
- A cluster with three ESXi 6.7 hosts added to it.
- Each host is connected to a 1 TB iSCSI LUN and our VMs are located on it.
- A VMkernel port group for vMotion traffic.
At first, I tried creating a distributed switch and migrating all VMkernel port groups and networks at the same time, but when I did this, I lost connection with vCenter and had to roll back the configuration.
After testing a few procedures, I managed to get it to work using the following steps.
- Create the vSphere Distributed Switch.
- Create port groups that match the standard switch port groups.
- Put one host into maintenance mode (evacuating the VMs to another).
- Add the host to the distributed switch, migrating uplinks and port groups.
- Exit maintenance mode and migrate VMs back onto this host (when migrating VMs choose the new distributed switch port groups for the VM networks).
- Repeat the steps for each host in the cluster.
Let’s perform the steps above on our lab, starting with creating the distributed switch.
Step 1: Create a vSphere Distributed Switch
Open the networking tab, right click on the datacenter, select Distributed Switch then New Distributed Switch…
Give the switch a name, I’ve left it as
DSwitch in this example.
Select the latest version then click NEXT.
Select 2 for the number of uplinks, name the default port group as
dManagement and click NEXT.
Click FINISH to create the distributed switch.
Step 2: Create Distributed port groups
Now we need to create new distributed port groups that match the ones of the standard switch (DMZ, ISCSI-1, ISCSI-2, VMotion). For each of the new port groups, I’ve used the same name but with a
d prefixed to the name.
Right click on the distributed switch, click Distributed Port Group… then New Distributed Port Group…
Name this one
dDMZ then click NEXT.
Assign the VLAN ID of 100 then click NEXT.
Click FINISH to create the port group.
Repeat the steps above for vMotion, ISCSI-1 and ISCSI-2. Once the ISCSI port groups have been created, we need to change the failover order so that each port group only uses one of the uplinks.
Right click on ISCSI-1 then click Edit Settings…
Click Teaming and failover, click on Uplink 2 then the down arrow to make it unused. Click OK to save the settings.
Repeat the steps above for ISCSI-2 except make Uplink 1 unused.
Step 3: Put one host into maintenance mode and add it to the Distributed Switch
With the distributed switch and port groups created we are now ready to add our first host to the switch.
Put esxi03 into maintenance mode (evacuating any VMs if it has any running).
Right click on the distributed switch then click Add and Manage Hosts….
Choose Add hosts then click NEXT.
Click New hosts…
Select the host we just put into maintenance mode then click OK.
Click on vmnic0 then Assign uplink.
Choose Uplink 1 then click OK.
Repeat the steps above for vmnic1 but assign Uplink 2.
Select the first VMkernel port group (Management Network) then click Assign port group.
Choose dManagement then click OK.
Repeat the steps above until all VMkernel port groups are assigned then click NEXT.
Since we are in maintenance mode, there will be no VM networks to migrate so you can click NEXT.
You can now remove the old standard vSwitch from the host.
Step 4: Exit maintenance mode and migrate VMs back onto this host
Exit the host from maintenance mode.
Right click on fw01 then click Migrate…
Select Change compute resource only then click NEXT.
Select esxi03 then click NEXT.
Change the VM networks to the distributed port groups then click NEXT.
After the VM has migrated, repeat the steps above to migrate the vCenter VM.
Now repeat the full process again until each host in the cluster has been added to the distributed vSwitch.
In this post we learned how to create a vSphere Distributed Switch and how to migrate a standard switch without any downtime to our running VMs.
Read Next - Part 8: Creating a Public Facing Web VM and Securing it with pfSense
As I’m sure you’re aware, there’s only so much information that can go into a blog post, which is why you might want to check out the book titled Mastering VMware vSphere 6.7* Mastering VMware vSphere 6.7* (Marshall, Brown, Fritz, Johnson) to get a more in depth understanding of vSphere.
What the * means above
Links marked with * are affiliated and can earn us a small commission at no additional cost to you, should you click through and make a purchase. For more details, read How This Site Is Financed.