Ready? Set! Let’s get started! First, we need to understand the Powershell cmdlets that we will use. There are two of them: Get-NetTCPSetting and Set-NetTCPsetting. Let’s start with Get-NetTCPSetting. Go ahead. Open a powershell window, type the cmdlet and pipe it through the Select command as shown in the example. You should see something like this:
123456789 PS C:WINDOWSsystem32> Get-NetTCPSetting | Select SettingNameSettingName-----------<strong><span>Automatic</span></strong>InternetCustomDatacenterCustom<strong><span>Compat</span></strong>DatacenterInternet
Why are those two templates in strikethrough font? Because those are two templates that you don’t have to worry about! The Automatic template is used for (automatically) switching between Internet and Datacenter templates. The Compat template is only for legacy applications and is not recommended for use with modern apps. Now we are down to four templates and this is getting closer to simplicity !
Referring to Figure 1 we see that there are really only 2 templates that can be customizable or not. The Internet template is used for connections with an RTT of more than 10 ms and the Datacenter template is used for connections with an RTT of 10 ms or less. Remember that Automatic template that I said you don’t need to worry about? Well you still don’t need to worry about it. But, just for information sake the Automatic template is taking the initial RTT as measured by the TCP connection handshake and applying the appropriate template to the TCP connection.
What’s the difference between the two? The Datacenter template is designed for low-latency LAN environments and the Internet template is designed for higher latency WAN environments. Now let’s have a look at all the settings that you can tune!
12345678910111213141516171819202122232425 PS C:Usersdahavey> Get-NetTCPSetting -SettingName InternetCustomSettingName : InternetCustomMinRto(ms) : 300InitialCongestionWindow(MSS) : 10CongestionProvider : CUBICCwndRestart : FalseDelayedAckTimeout(ms) : 40DelayedAckFrequency : 2MemoryPressureProtection : DisabledAutoTuningLevelLocal : NormalAutoTuningLevelGroupPolicy : NotConfiguredAutoTuningLevelEffective : LocalEcnCapability : DisabledTimestamps : DisabledInitialRto(ms) : 3000ScalingHeuristics : DisabledDynamicPortRangeStartPort : 49152DynamicPortRangeNumberOfPorts : 16384AutomaticUseCustom : DisabledNonSackRttResiliency : DisabledForceWS : EnabledMaxSynRetransmissions : 2AutoReusePortRangeStartPort : 0AutoReusePortRangeNumberOfPorts : 0
WoW! Look at all those settings you can tune! That is enough to make an uber geek giggle with joy! Use Set-NetTCPSetting to change things. Like this:
123456789101112131415161718192021222324252627 ### Change the congestion provider to LEDBATPS C:Usersdahavey> Set-NetTCPSetting -SettingName InternetCustom -CongestionProvider LEDBATPS C:Usersdahavey> Get-NetTCPSetting -SettingName InternetCustomSettingName : InternetCustomMinRto(ms) : 300InitialCongestionWindow(MSS) : 10<strong>CongestionProvider : LEDBAT ### </strong><strong><</strong><strong>------- Changed</strong>CwndRestart : FalseDelayedAckTimeout(ms) : 40DelayedAckFrequency : 2MemoryPressureProtection : EnabledAutoTuningLevelLocal : NormalAutoTuningLevelGroupPolicy : NotConfiguredAutoTuningLevelEffective : LocalEcnCapability : EnabledTimestamps : DisabledInitialRto(ms) : 3000ScalingHeuristics : DisabledDynamicPortRangeStartPort : 49152DynamicPortRangeNumberOfPorts : 16384AutomaticUseCustom : DisabledNonSackRttResiliency : DisabledForceWS : EnabledMaxSynRetransmissions : 2AutoReusePortRangeStartPort : 0AutoReusePortRangeNumberOfPorts : 0
Fair warning! If you do not know what a setting means you it’s probably best to leave it alone. If you get into trouble and want to reset to default:
123456789101112131415161718192021222324252627282930 ### Reset tcp parameters to defaultPS C:Usersdahavey> netsh int tcp resetReset of all TCP parameters OK!Ok.PS C:Usersdahavey> Get-NetTCPSetting -SettingName InternetCustomSettingName : InternetCustomMinRto(ms) : 300InitialCongestionWindow(MSS) : 10<strong>CongestionProvider : CUBIC ### </strong><strong><</strong><strong>------- Reset to default</strong>CwndRestart : FalseDelayedAckTimeout(ms) : 40DelayedAckFrequency : 2MemoryPressureProtection : EnabledAutoTuningLevelLocal : NormalAutoTuningLevelGroupPolicy : NotConfiguredAutoTuningLevelEffective : LocalEcnCapability : EnabledTimestamps : DisabledInitialRto(ms) : 3000ScalingHeuristics : DisabledDynamicPortRangeStartPort : 49152DynamicPortRangeNumberOfPorts : 16384AutomaticUseCustom : DisabledNonSackRttResiliency : DisabledForceWS : EnabledMaxSynRetransmissions : 2AutoReusePortRangeStartPort : 0AutoReusePortRangeNumberOfPorts : 0
Please see the links to Set/Get-NetTCPSettings for descriptions of the individual settings and what they do. Have fun and happy TCP tuning!