PowerShellでWindowsのネットワーク安定化設定 SNP無効化

TL;DR 見出しにジャンプ
ドライバ関係でWindows環境が飛んでクリーンインストールしたのは良いものの、ネットワークが妙に不安定で、
- YouTubeの再生が不安定
- ページの読み込みが妙に遅いときがある
- ゲーム放置中にタイムアウト
- スピードテストの結果はいつも通り
といった状態。
言わずもがなドライバ当ててWindows Updateして...と正しい手順は踏んでいる筈なので頭を抱えていたら、以前行った設定を思い出した。
その名も...
SNP無効
である。
10GbEが這ってるような逸般の誤家庭ではないので、効果があるだろうということで。
netsh 見出しにジャンプ
C:\Windows\system32>netsh interface tcp show global
アクティブ状態を照会しています...
TCP グローバル パラメーター
----------------------------------------------
Receive-Side Scaling 状態 : enabled
受信ウィンドウ自動チューニング レベル : normal
アドオン輻輳制御プロバイダー : default
ECN 機能 : disabled
RFC 1323 タイムスタンプ : disabled
初期 RTO : 1000
Receive Segment Coalescing 状態 : enabled
非 Sack の Rtt 回復性 : disabled
最大 SYN 再送信数 : 4
Fast Open : enabled
Fast Open フォールバック : enabled
HyStart : enabled
ペーシング プロファイル : off
崩れた表示でスイッチが入った。
PowerShellでやるもん!
Microsoftの公式ドキュメントを見ることを推奨
https://docs.microsoft.com/ja-jp/windows-server/networking/technologies/network-subsystem/net-sub-performance-tuning-nics
netshに代わるPowerShell Cmdlet 見出しにジャンプ
コマンドレット一覧を取得
Get-Command -Module NetTCPIP
https://docs.microsoft.com/en-us/powershell/module/nettcpip/
- Get-NetTCPSetting/Set-NetTCPSetting
- Get-NetOffloadGlobalSetting/Set-NetOffloadGlobalSetting
この辺りを使っていく。
NetTCPSetting 見出しにジャンプ
Get-Help Get-NetTCPSetting
Get-Help Set-NetTCPSetting
https://docs.microsoft.com/en-us/powershell/module/nettcpip/get-nettcpsetting
https://docs.microsoft.com/en-us/powershell/module/nettcpip/set-nettcpsetting
初期状態。Select-Object
で項目を絞り、Format-Table
のような表示ができる。
Get-NetTcpSetting | Select-Object SettingName,AutoTuningLevelEffective,AutoTuningLevelLocal
SettingName AutoTuningLevelEffective AutoTuningLevelLocal
----------- ------------------------ --------------------
Automatic
InternetCustom Local Normal
DatacenterCustom Local Normal
Compat Local Normal
Datacenter Local Normal
Internet Local Normal
AutoTuningLevelLocal
をNormal
->HighlyRestricted
に変更。
管理者権限がないと、Set-NetTCPSetting: アクセスが拒否されました。
と怒られる。
Set-NetTCPSetting -AutoTuningLevelLocal HighlyRestricted
RFC 1323 タイムスタンプを有効化。
Set-NetTCPSetting -Timestamps Enabled
変更が反映されているか確認。
Get-NetTcpSetting | Select-Object SettingName,AutoTuningLevelEffective,AutoTuningLevelLocal,Timestamps
SettingName AutoTuningLevelEffective AutoTuningLevelLocal Timestamps
----------- ------------------------ -------------------- ----------
Automatic
InternetCustom Local HighlyRestricted Enabled
DatacenterCustom Local HighlyRestricted Enabled
Compat Local HighlyRestricted Enabled
Datacenter Local HighlyRestricted Enabled
Internet Local HighlyRestricted Enabled
SettingName
がAutomatic
の場合、Datacenter
かInternet
を自動的に割り振ってくれるみたい。
Get-NetTransportFilter
SettingName : Internet
Protocol : TCP
LocalPortStart : 0
LocalPortEnd : 65535
RemotePortStart : 0
RemotePortEnd : 65535
DestinationPrefix : *
NetOffloadGlobalSetting 見出しにジャンプ
https://docs.microsoft.com/en-us/powershell/module/nettcpip/get-netoffloadglobalsetting
https://docs.microsoft.com/en-us/powershell/module/nettcpip/set-netoffloadglobalsetting
Get-NetOffloadGlobalSetting
ReceiveSideScaling : Enabled
ReceiveSegmentCoalescing : Enabled
Chimney : Disabled
TaskOffload : Enabled
NetworkDirect : Enabled
NetworkDirectAcrossIPSubnets : Blocked
PacketCoalescingFilter : Enabled
RSS、タスクオフロードの無効化をする例(不要だと思う)。 こちらも管理者権限が必要。
Set-NetOffloadGlobalSetting -ReceiveSideScaling Disabled
Set-NetOffloadGlobalSetting -TaskOffload Disabled