Creating a Custom DSC Resource to Configure Jumbo Frames on Network Cards

Recently while working on configuring a new server with DSC (Desired State Configuration), I discovered that there wasn’t a DSC resource for configuring the jumbo frames setting on network cards so I decided to write my own.

This blog article steps you through the process of creating a custom DSC resource, specifically one that is used to configure the jumbo frames setting on network cards. The specific settings for jumbo frames can vary depending on your network card manufacturer and the specific driver. I believe that I’ve narrowed down the settings so this resource should work on all network cards/drivers that support jumbo frames. I’ve seen some drivers that don’t support jumbo frames in the past, but I’m yet to find one to test this resource on so I can add additional code to check to see if jumbo frames is even supported.

Consider this DSC resource to be beta and use it at your own risk <period>.

The workstation used in this scenario is running Windows 8.1 and the server is running Windows Server 2012 R2 and they are both a member of the same domain. Both are running PowerShell version 4 which ships in the box with both of those operating systems.

First, download the xDscResourceDesigner PowerShell Module from the Microsoft Script Repository and while you’re at it, why not use PowerShell to perform the actual download:

dsc-resource1

Since the zip file was downloaded from the Internet, you’ll need to unblock it:

dsc-resource2

As specified in the instructions, extract the contents of the downloaded file to a folder under “$env:ProgramFiles\WindowsPowerShell\Modules”.

Since the machine I’m using is running Windows 8.1 with PowerShell version 4 installed, I’ll use a function I created a while back to accomplish the task of extracting the contents of the zip file to the specified folder:

dsc-resource3

My Unzip-File function can be downloaded from the Microsoft Script Repository.

If you happen to be running the Windows Management Framework 5.0 Preview September 2014 version, you can use the native Extract-Archive cmdlet instead:

dsc-resource4

Now to create what I like to call the skeleton of your DSC resource:

If you receive a strange error like this one:

dsc-resource5

Check the execution policy on the machine you’re working on. Any setting other than “Restricted” should work. My recommendation is “RemoteSigned”:

dsc-resource6

Let’s try that again now that the execution policy has been set to remote signed:

dsc-resource7

Notice in the previous command, I added a prefix of “c” to the name of the JumboFrames DSC resource that I’m creating. That stands for “community”.

Creating the “skeleton” could also be accomplished with a PowerShell one-liner. This time I’ll also add the -Verbose parameter so you can see the details of what’s happening:

dsc-resource8

That creates the directory structure, a PowerShell script module (psm1 file):

And a mof schema file:

Create a module manifest for the PowerShell module that was created in the previous step:

dsc-resource9

You’ll end up with this module manifest (psd1 file):

Make the necessary changes to the script module (psm1 file) to get, set, and test for the value of the jumbo frames settings on the specified network card:

The cJumboFrames resource needs to also exist on any servers where a DSC configuration will be applied that replies on this resource. There are several tutorials on the web for distributing a resource so I won’t duplicate that content here. I’ve simply copied the cJumboFrames folder from the Windows 8.1 workstation I’ve been developing it on to the same location on the SQL02 server where I plan to apply a configuration that will use it.

Create a DSC configuration to test the custom cJumboFrames DSC resource:

Run the configuration, specifying SQL02 as the computer name. This creates a mof configuration file that is specific to the SQL02 test server.

dsc-resource10

Before applying the configuration, let’s check the current jumbo frames setting on SQL02:

dsc-resource11

As shown in the previous results, we can see that the network card is set to a standard packet size of 1514 bytes.

Now to apply the DSC configuration that we previously created to SQL02:

dsc-resource12

Check the jumbo frames settings again now that the configuration has been applied:

dsc-resource13

You can see that jumbo frames have been enabled for that network card and the maximum packet size is now set to 9014 bytes.

I also want to show you the jumbo frames settings from another Windows Server 2012 R2 machine that has a network card produced by a different manufacturer. This should help you to understand why I wrote the code in the script module the way I did:

dsc-resource14

Any thoughts or feedback for improvements on this resource or the process of creating a DSC resource would be appreciated.

Want to learn more about creating DSC resources? There’s a section on that topic in the DSC book which can be downloaded from the free eBook section on PowerShell.org.

Looking for DSC resources? While there are several that ship with PowerShell version 4, the PowerShell team has released 7 different waves of DSC resources. You can also find community created DSC resources on PowerShell.org’s GitHub.

Have questions about DSC that aren’t related to this blog post? I recommend posting them in the DSC forum on PowerShell.org.

µ

3 Comments

  1. Daniel Krebs

    Thanks for this great post. Due to the very well presented information I was able to write my first DSC resource within minutes. I’ve create a pull request for the PowerShell.org DSC GitHub repository today to hopefully get my first resource cNetAdapterName published.

    Best,
    Daniel

    Reply

Leave a Reply

%d bloggers like this: