Using vSphere Distributed Virtual Switches
In my last post, Getting Started with vSphere Distributed Switches, I covered what the vSphere Distributed Switch is, the benefits of using it, what’s new in version 5, and how to “install” a vSphere distributed switch. In this post, we’ll take the next steps in using this new dvSwitch by adding hosts, uplinks, virtual machines, and more. So with that, let’s get started!
Moving Uplinks from a Standard Switch to a dvSwitch
One of the problems I had when I went to add the switch was that I had a host that I wanted to add (esx1, in my case) that didn’t have any available NICs that were up and connected to the network. Of course, I could connect those NICs to solve that problem. Or, you can migrate uplinks that are in use by a standard vSwitch (you have to be careful) but I would prefer to keep my standard vSwitch when adding my dvSwitch, for the time being, until I am comfortable. So, let’s say that I have other NICs, already connected, that are part of a standard switch and acting as redundant paths. In that case, I could remove one or more of those redundant NICs from the standard vSwitch and add them to the new dvSwitch to get that host participating (while having both a vSwitch and dvSwitch).
To first free up these NICs from the standard switch, in the vSphere Client, go to the ESXi host in the hosts and cluster inventory. Click on the Configuration tab for the host and go down to Networking. Click on your vSwitch and then on Properties. Click on the Network Properties. Here you can see the adaptors assigned to this vSwitch.
Click on the NIC that you want to remove and land click Remove. That NIC is now available to be added as an uplink to the dvSwitch. Of course, if you did have free NICs that weren’t assigned to any vSwitch then you wouldn’t have had to remove any, as described above.
With at least one free physical NIC, go back into the networking inventory, click on the dvSwitch, and click Add Host, as you see in Figure 2, below.
I selected the host that I had not yet added (esx1 in my case) and the vmnic4 that I removed (and freed up) from the standard vSwitch and clicked Next.
Now, you’ll be given the opportunity to manage the vmkernel virtual adaptor from the standard switch to the dvSwitch. Since I will have both for some time (and I am just testing dvSwitch), I’ll opt to not migrate the virtual adaptor. A bit of caution on migrating vmkernel adaptors! Remember if you were to migrate your only vmkernel adaptor to, let’s say, a dvSwitch that had uplinks that were misconfigured (maybe on the wrong VLAN) then you could be stuck with a down host (from the point of the iSCSI / NFS storage going down and the vSphere & vCenter services no longer having network connectivity).
Next, you’ll be given the opportunity to migrate virtual machine NICs from the standard vSwitch to the dvSwitch. Of course, as long as the standard switch remains, you can do this later. For now, I opted not to migrate any VM networking.
Here’s what it looked like, just before I clicked Finish.
Once completed, if I look at the Ports tab on the uplink port group, you can see that I have one adaptor from each of my hosts and that both of them are showing “Link Up”.
With at least one uplink from each of my hosts, I can move on to two other steps:
- Adding port groups
- Migrating vmkernel ports
- Adding virtual machines networks
Adding Port Groups to a dvSwitch
If you chose to create it when you created the dvSwitch, a default dv Port Group was created for you called, you guessed it, “dvPortGroup”. Of course, you can use this and it, by default, offers up to 128 statically bound virtual ports.
Quick side note – there are 3 types of port bindings for a port group. They are:
- Static – use static binding to assign a port to a virtual machine when the virtual machine connects to the distributed port group.
- Dynamic - use dynamic binding to assign a port to a virtual machine the first time the virtual machine powers on after it is connected to the distributed port group. Dynamic binding is depricated in ESXi 5.0.
- Ephemeral - use ephemeral for no port binding.
You can edit these port bindings on the property for the dvportgroup.
For more information on port group bindings, see VMware KB 1033312.
When it comes to adding port groups, best practices say that you should add dv port groups based on the particular types of applications / VMs that will be in the port group. For example, let’s create a dvPortGroup for “WebServers”. To do it, right-click on the dvSwitch and click New Port Group.
Enter a name for the new port group, set the VLAN type, and click Next. Review what you are about to add and click Finish.
Here’s what it looks like when done:
With your new port group added (now 2 total), add virtual machines to the dvSwitch.
Adding Virtual Machines to your dvSwitch
To migrate virtual machines you could manually move a virtual machine’s network adaptor to one of the new dv port groups or, the easier route is to use the Migrate Virtual Machine Networking Wizard that you access by right-clicking on the dvSwitch.
The wizard asks you for the source and destination vSwitch or dvSwitch. When you are creating a new dvSwitch, it’s likely that you are going from a standard vSwitch to a dvSwitch (as you see in Figure 13, below).
In my case, I selected a VM called “wordpress1” to migrate to the new dvSwitch port group.
After clicking Finish, I verified that the VM was indeed on the dvSwitch and, in this case, it was statically assigned to port 10 on the dvPortGroup.
Of course, one of the greatest benefits of using dvSwitches is that you can apply policies to port groups, covering virtual machines on all ESXi hosts, in one quick configuration. There are 7+ different types of dvSwitch policies including security, traffic shaping, VLAN, teaming / failover, resource allocation, monitoring, and miscellaneous. Stay tuned to my future articles for more about configuring dvSwitch policies and other more advanced options.
What Did You Learn?
With a little effort (and great instructions, like these), learning to use vSphere distributed virtual switches isn’t hard and there are so many new features provided, with centralized control being the greatest benefit. In this follow up article to Getting Started with vSphere Distributed Switches, you learned how to remove uplinks from a standard switch, add a host and uplink to the new dvSwitch, add a new port group, and migrate virtual machine networking. For the official vSphere distributed virtual switch documentation, click here.