Tuesday, September 07, 2010

IT From All Angles

Minimize
Mar 31

Written by: Matthew.Mattoon
Wednesday, March 31, 2010 

When using a Core version of Hyper-V 2008 R2, be it Hyper-V Server 2008 R2 or Windows Server 2008 R2 Standard Core, you are doing a good thing to conserve resources and minimize the attack footprint of your virtualization hosts. However this comes at a price. One of the most obvious misses in this matter is the enabling of Jumbo Frames on the Virtual Switch Interface. This enables your guests to reach out to storage directly using jumbo frames (mtu size of greater than 1500 bytes – however in this article we will be working specifically with 9000 bytes).

Basic Hyper-V Networking

So first let’s familiarize ourselves with basic Hyper-V networking. When a virtual network is created in Hyper-V it separates out the network interface of the parent partition (which is the source for the virtual switch) and duplicates that connection (Figure 1). The parent partition is then attached to the Virtual Switch in the same way as a guest is. Now for simplicity I like to name everything consistently. I generally have 2 storage networks (for multipathing) and before creating the switch I rename the interface to “Storage Primary (Switch)” or “Storage Secondary (Switch)” and then rename the newly created interface to “Storage Primary (Interface)” or “Storage Secondary (Interface)” this keeps my head on straight as far as what interfaces are the switches and what are the interfaces for the parent.

image

Figure 1 – Diagram of Hyper-V guest and parent network connectivity via virtual switch

Enabling Jumbo Frames on a non-core Hyper-V system

Now in order to enable jumbo frames on your network you must enable jumbo frames on the sender, the receiver and all network equipment in between. Now if I wanted to enable jumbo frames between VM1 and VM2 (on the same server) then I enable it on both guests and the Hyper-V switch and viola. So keep in mind that your storage and switches will need a bit of magic to get them going. So to display the procedure I will demonstrate on a non-core version (Figure 2).

image

Figure 2 – Steps to enable Jumbo Frames when using non-core version of Hyper-V

Enabling Jumbo Frames on a core Hyper-V system

Enabling jumbo frames on core is not easy. In fact it can be downright difficult. This change consists of two parts, enable jumbo frames on the interface, and enable jumbo frames in the registry. I recommend you do this when there is not a Virtual Switch created on the interface, it simplifies the registry portion.

Part 1 – Enable Jumbo Frames using netsh

netsh interface ipv4 set subinterface “Storage Primary (Switch)” mtu=9000 store=persistent

Part 2 – Enable Jumbo Frames using registry

Browse to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters\Interfaces each key in this location contains a GUID of a Network Interface. Looking inside each key we want to match the IPAddress to the interface GUID. We will need that GUID in a moment.

image

Figure 3 – Locating the Interface GUID

Now that we have found the GUID, browse to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\

You will see numerical 4-digit subkeys. Under each subkey find the “NetCfgInstanceID” string, you are looking for the subkey with the “NetCfgInstanceID” which matches the GUID you found earlier. Once you find this you can modify the “*JumboPacket” to show 9014 which will give it a 9000 mtu (14 are for the headers).

Give the host a reboot and enable jumbo frames on the guests and you should be able to verify with “ping -f -l 8972”

Script Please?

This sort of thing is begging to be scripted. So I have written a powershell script which will do both parts of the configuration automagically… You will need to ensure that you have a static IP address configured on the interface you want to configure.

Download the script from http://blog.allanglesit.com/downloads/Set-JumboFrame.ps1

Install Powershell - “start /w ocsetup MicrosoftWindowsPowershell”

Enable Scripts to run in Powershell - “set-executionpolicy remotesigned”.

Execute Script Examples

· ./Set-JumboFrame.ps1 enable 10.0.0.1

· ./Set-JumboFrame.ps1 disable 10.0.0.1

· ./Set-JumboFrame.ps1 verify 10.0.0.1

image

After enabling jumbo frames you will need to create the virtual switch and reattach any guests to it.

So there you have it. This script provides a much simpler way of configuring jumbo frames on Hyper-V core virtual switches.

Copyright ©2010 Matthew.Mattoon

Tags:

7 comment(s) so far...

Hyper-V blog by Hans Vredevoort

Cool stuff Matthew! Very well explained. Makes me almost want to switch on jumbo frames. Perhaps you could elaborate on the do's and don'ts for jumbo frames. Do you only use it for iSCSI storage network interfaces and virtual switches?

Regards, Hans Vredevoort
MVP Cluster

By Hans Vredevoort on   Thursday, April 01, 2010

Re: Enabling Jumbo Frames on Hyper-V 2008 R2 Virtual Switches

There is the command 'set' missing between ipv4 and subinterface in the netsh command.

Example

netsh interface ipv4 SET subinterface "Local Area Connection 4" mtu=9000 store=persistent

By Roman Korecky on   Thursday, April 01, 2010

Re: Enabling Jumbo Frames on Hyper-V 2008 R2 Virtual Switches

You are correct Roman, good catch. The script is accurate though. I will make the change now.

By Matthew Mattoon on   Thursday, April 01, 2010

Re: Enabling Jumbo Frames on Hyper-V 2008 R2 Virtual Switches

Hans,

I personally only use jumbo frames on my storage network, as jumbo frames provide no added benefit to small packets (and the negotiation process can cause problems between devices that do and do not support it). If you are not running Jumbo Frames I recommend you try it, the only bummer is that the Linux ICs do not support jumbo frames so my Linux guests are left in the cold. :(

-matt

By Matthew Mattoon on   Thursday, April 01, 2010

Re: Enabling Jumbo Frames on Hyper-V 2008 R2 Virtual Switches

Matt,

I appreciate you showing how to edit the registry on server core to change these values, and not just posting the script as I love to do things "on my own".

Thanks

By James on   Monday, May 31, 2010

Re: Enabling Jumbo Frames on Hyper-V 2008 R2 Virtual Switches

Hi James,

No problem at all. Ultimately my goal was to simply provide people with documented steps, although in the process of documenting them I found that I was not going to be able to make these changes in my own production environment with the high degree of reproducibility which can only be achieved with a script. So I instead went with an easy or easier approach.

-matt

By Matthew.Mattoon on   Monday, May 31, 2010

Re: Enabling Jumbo Frames on Hyper-V 2008 R2 Virtual Switches

Excellent post Matt, was exactly what I was looking for! Have now bookmarked your site! :-)

By Jeff on   Tuesday, July 06, 2010

Your name:
Your email:
(Optional) Email used only to show Gravatar.
Your website:
Title:
Comment:
Security Code
Enter the code shown above in the box below
Add Comment   Cancel 

Search IT From All Angles Blog

Minimize