Product Announcements

Tagging VMkernel Traffic Types Using ESXCLI 5.1

In earlier releases of ESXi, a VMkernel interface could transport three types of traffic: Management, vMotion and Fault Tolerance. To enable a particular traffic type, one would use either the vSphere Web/C# Client or the vSphere API. Some of you may have recalled using an undocumented command-line tool called vim-cmd in the ESXi Shell to enable vMotion and Fault Tolerance traffic. An issue with this tool is it does not support the Management traffic type. This made it a challenge to completely automate the provisioning of VMkernel interfaces from a scripted installation (kickstart) perspective and required the use of remote CLI/APIs to enable the Management traffic type.

Luckily in vSphere 5.1, we now have an easy way of tagging these various traffics types for a VMkernel interface using the new ESXCLI 5.1.

There is new namespace in ESXCLI 5.1 called “tag” which is available under “esxcli network ip interface” and you will be able to perform the following operations: get, add and remove.

vi-admin@vMA51:~> esxcli –server vcenter51 –vihost pod23-esx-01a.pml.local –username root network ip interface tag
Usage: esxcli network ip interface tag {cmd} [cmd options]

Available Commands:
add                  Adds a tag on a given VMkernel network interface.
get                   Gets the tags set on the given VMkernel network interface.
remove           Removes a tag on a given VMkernel network interface.

Note: You will need to be connected to an ESXi 5.1 host to see this new namespace, previous releases of ESXi will not have the the tag namespace.

We can retrieve the assigned traffic types for a given VMkernel interface by running the “get” operation and specifying the particular interface. Here is an example output for the vmk0 interface which contains the default Management traffic type:

vi-admin@vMA51:~> esxcli –server vcenter51 –vihost pod23-esx-01a.pml.local –username root network ip interface tag get -i vmk0
Tags: Management

In my environment, I have two additional VMkernel interfaces vmk1 and vmk2 that have already been created and by default, no traffic types will be assigned. Before we start assigning additional traffic types, let’s take a look at the supported traffic types and more importantly, the tag name for each of these traffic types in ESXCLI.

Here is a table of the traffic types and their respective tag names that are supported in ESXi 5.1:

Traffic Type ESXCLI Tag Name
Management Management
vMotion VMotion
Fault Tolerance faultToleranceLogging
vSphere Replication (NEW) vSphereReplication

As you can see from the table, with the release of vSphere 5.1, we now support an additional traffic type for vSphere Replication. If you are not familiar with vSphere Replication, check out these videos here as well as the Introduction to vSphere Replication Whitepaper here.

Now that we know the tag name for each of the VMkernel traffic types, let’s go ahead and start tagging! You can add one or more tags to a VMkernel interface, but you can only add one tag at time. To do so, you will be using the “add” operation and specifying the VMkernel interface name as well as the tag name.

Here is an example:

vi-admin@vMA51:~> esxcli –server vcenter51 –vihost pod23-esx-01a.pml.local –username root network ip interface tag add -i vmk1 -t VMotion
vi-admin@vMA51:~> esxcli –server vcenter51 –vihost pod23-esx-01a.pml.local –username root network ip interface tag add -i vmk2 -t vSphereReplication
vi-admin@vMA51:~> esxcli –server vcenter51 –vihost pod23-esx-01a.pml.local –username root network ip interface tag add -i vmk2 -t faultToleranceLogging

For our vmk1 interface, we are adding in the vMotion traffic type and for vmk2 we are adding both vSphere Replication and Fault Tolerance traffic types. Make sure you are using the correct tag name for the traffic type as shown above or just type –help when using the add operation to get a list of supported tag names. To verify that our tags were applied correctly, we can perform another “get” operation on both vmk1 and vmk2.

To remove a traffic type from a VMkernel interface, you will need to use the “remove” operation. You can only remove one traffic type at a time, so if you have multiple tags that you want to remove, you will need to remove them one at a time.

Here is an example:

vi-admin@vMA51:~> esxcli –server vcenter51 –vihost pod23-esx-01a.pml.local –username root network ip interface tag remove -i vmk2 -t vSphereReplication
vi-admin@vMA51:~> esxcli –server vcenter51 –vihost pod23-esx-01a.pml.local –username root network ip interface tag remove -i vmk2 -t faultToleranceLogging

 

Get notification of new blog postings and more by following lamw on Twitter:  @lamw