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.

Overview

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.

Prerequisites

Ideally you should have read the previous tutorials in the series before following the steps in this tutorial.

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.

Steps involved

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.

  1. Create the vSphere Distributed Switch.
  2. Create port groups that match the standard switch port groups.
  3. Put one host into maintenance mode (evacuating the VMs to another).
  4. Add the host to the distributed switch, migrating uplinks and port groups.
  5. Exit maintenance mode and migrate VMs back onto this host (when migrating VMs choose the new distributed switch port groups for the VM networks).
  6. 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…

screenshot

Give the switch a name, I’ve left it as DSwitch in this example.

screenshot

Select the latest version then click NEXT.

screenshot

Select 2 for the number of uplinks, name the default port group as dManagement and click NEXT.

screenshot

Click FINISH to create the distributed switch.

screenshot

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…

screenshot

Name this one dDMZ then click NEXT.

screenshot

Assign the VLAN ID of 100 then click NEXT.

screenshot

Click FINISH to create the port group.

screenshot

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…

screenshot

Click Teaming and failover, click on Uplink 2 then the down arrow to make it unused. Click OK to save the settings.

screenshot

Repeat the steps above for ISCSI-2 except make Uplink 1 unused.

screenshot

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).

screenshot

Right click on the distributed switch then click Add and Manage Hosts….

screenshot

Choose Add hosts then click NEXT.

screenshot

Click New hosts…

screenshot

Select the host we just put into maintenance mode then click OK.

screenshot

Click NEXT.

screenshot

Click on vmnic0 then Assign uplink.

screenshot

Choose Uplink 1 then click OK.

screenshot

Repeat the steps above for vmnic1 but assign Uplink 2.

screenshot

Select the first VMkernel port group (Management Network) then click Assign port group.

screenshot

Choose dManagement then click OK.

screenshot

Repeat the steps above until all VMkernel port groups are assigned then click NEXT.

screenshot

Since we are in maintenance mode, there will be no VM networks to migrate so you can click NEXT.

screenshot

Click FINISH.

screenshot

You can now remove the old standard vSwitch from the host.

screenshot

Step 4: Exit maintenance mode and migrate VMs back onto this host

Exit the host from maintenance mode.

screenshot

Right click on fw01 then click Migrate…

screenshot

Select Change compute resource only then click NEXT.

screenshot

Select esxi03 then click NEXT.

screenshot

Change the VM networks to the distributed port groups then click NEXT.

screenshot

After the VM has migrated, repeat the steps above to migrate the vCenter VM.

screenshot

Now repeat the full process again until each host in the cluster has been added to the distributed vSwitch.

screenshot

Conclusion

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

Further reading

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* (Marshall, Brown, Fritz, Johnson) to get a more in depth understanding of vSphere.

Written by Tony

I'm a blogger, software developer and sysadmin, with a degree in applied computing and 16+ years experience managing IT systems. Get in touch: tony@graspingtech.com

Tags: ESXi Fusion vCenter