Several vSphere components can benefit from using a larger network frame size (MTU) than the regular size of 1500 bytes. vMotion, Storage: NFS, iSCSI and VSAN are examples that would gain some performance by increasing the frame size. In most cases, you would configure the MTU to a jumbo frame size, which is 9000.

Configuring the MTU size throughout your infrastructure can be tedious though, as you need to make sure you configure the entire chain of the network flow. If you’re not using Host Profiles for your ESXi host configuration, you have to make sure that you configure the involved vSwitches (standard and/or distributed) and the VMKernel PortGroups that need the larger size MTU. Forget this and you can have operational issues.

Having to configure the MTU size on several ESXi hosts which have standard vSwitches for their storage, vMotion or other functionality that you want to jumbo frames, is a repetitive task and it can take a while. We wouldn’t be system admins if we wouldn’t try to automate all the things that take time from us; so lets take a look at some PowerShell functions that can help you with configuring the MTU size.

Standard vSwitch

You can configure the MTU size of a standard vSwitch with this small snippet:

The first line retrieves the object for vSwitch0 on ESXi host esxi01.lab.local. The second line uses that vSwitch object to configure the MTU size.

Distributed vSwitch

The VDS can be configured in a similar fashion as the standard vSwitch, with the exception that we need to use the VDS module in the PowerCLI framework:

Here the first line imports the VDS module, which we need before the second line can be executed. The second line gets the object of the Distributed vSwitch named dvSwitch and the third line uses that object to configure the MTU size on the VDS.

VMKernel PortGroups

Lastly, the VMKernel PortGroup that you’re going to be using for Storage, vMotion or something else that needs jumbo frames.

Here, the first line looks for the VMKernel port that’s named vmk0 and is on the ESXi host esxi01.lab.local. The second line takes the vmkernel portgroup object and configuring the MTU on it to 9000.

Want it to be easier?

I also created a PowerShell script that puts these functions together in an easy to use package. It’s available on GitHub:

gitHub-download-button

This script can set the MTU on all vSwitches and VMKernel PortGroups with a certain name inside a specific DRS Cluster. Easy use for changing the MTU size across a multitude of ESXi hosts.

Using it is pretty simple, here’s an example:

More information is on GitHub!