Another new version of Windows Server, more features, and another set of PowerShell scripts to write
My host design will be taking advantage of the fact that I have 4 * 10 GbE NICs in each host to play with, and I’ll be implementing my recent converged networks design for SMB 3.0 storage (use the search tool on the top right).
A key in the design is to use the full bandwidth of the NICs. That means configuring the packet or payload size of each NIC, aka configuring Jumbo Frames. You can do this by hand, but that’s going to:
- Get pretty boring after a couple of NICs.
- Be mistake prone: please send €10 to me every time you get this setting wrong if you disagree with me and continue to do it by hand.
You can configure this setting using PowerShell. It’s not immediately discoverable, but here’s how I discovered it for my NICs.
I ran Get-NetAdapterAdvancedProperty, targeting a 10 GbE NIC. That returned the advanced settings and their values of the NIC. These aren’t the traditional attributes. Each setting has two values:
- DisplayName: The NIC setting name
- DisplayValue: The NIC setting value
I knew from the GUI that the DisplayName was Packet Size and that the desired DisplayValue would be 9014. Now I could configure the setting:
Set-NetAdapterAdvancedProperty <NIC Name> –DisplayName “Packet Size” –DisplayValue “9014”
I could run that command over and over for each NIC. Consistent Device Naming (CDN) would make this easier, if my servers were new enough to have CDN
I want to configure all my 10 GbE NICs and not configure my still-enabled 1 GbE NIC (used for remote management). Here’s how I can target the NICs with the setting:
Get-NetAdapter * | Where-Object { $_.TransmitLinkSpeed –EQ “10000000000” } | Set-NetAdapterAdvancedProperty –DisplayName “Packet Size” –DisplayValue “9014”
The first half of that line finds the 10 GbE NICs, thus filtering out the 1 GbE NICs. Now I can use that line as part of a greater script to configure my hosts.
Slight adjustment I had to do to get it to work on 2012 R2.
$Netadapter = Get-NetAdapter * | Where-Object { $_.TransmitLinkSpeed –EQ “10000000000” }
Set-NetAdapterAdvancedProperty $Netadapter.name -DisplayName “Jumbo Packet” -DisplayValue “9014 Bytes”
I did this with a batch script. My problem is it works on some adapters and not others. You have to run the script as admin for it to work. It first displays a list of adapters, you type in the index number so it knows which one to change. Then it sets the MTU to 9000. or 9014, or 9198 or whatever you edit that number to be in the script. It tries to change the MTU and then displays the list of adapters again so you can see if it changed or not. I have also found some machine won’t change till after a reboot. It is weird because they are all running windows 10 and are similar machines. But I bought different Network adapters at different times. It is quite weird. On one machine I can change one adapter fine the other I can not. I wrote it to make it easy for people to configure an ethernet adapter to be used with highspeed video cameras on the fly instead of me having to tell them over the phone how to manually do it in windows. The other problem is knowing which MTU value to use. One adapter I tried only went up to 7000 which I couldn’t use with the camera. some do 9014, 9000, or 9198. How do i know in advance which one to use? So the script became useless for what it was intended for but it is just a riddle I have tried to figure out instead. I will try your power shell script out and see if it works better than my Batch. I also think there might be a new Netsh command for this and possibly I am using an older command.
Here is the Batch Script:
@echo off
netsh interface ipv4 show interface
@echo off
echo Enter the index of the network adapter you want to change.
set /p input=””
cls
echo You Selected %input%
netsh interface ipv4 set interface %input% mtu=9000 store=persistent
pause
netsh interface ipv4 show interface
pause
My next step is to probably find the registry keys that the drop down menu in windows manipulates and mess with them. Ideally I want to find something that can consistently do this across any machine running windows 10 with any adapter so it can be added to the camera software itself.