Files
for-servers/windows/win-network-boost.ps1

91 lines
3.9 KiB
PowerShell

# win-network-boost.ps1 — улучшение интернет-соединения на Windows 11
# Запуск от админа: PowerShell → правый клик → Run as Administrator → .\win-network-boost.ps1
# encoding: UTF-8 with BOM
Write-Host "=== Network Boost - Windows 11 ===" -ForegroundColor Cyan
Write-Host ""
# 1. Network Throttling — снимает ограничение на игровой трафик
Write-Host "[1/5] Network throttling off..." -ForegroundColor Yellow
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile" /v "NetworkThrottlingIndex" /t REG_DWORD /d 0xffffffff /f | Out-Null
Write-Host " OK"
# 2. Nagle's algorithm off — меньше задержка TCP
Write-Host "[2/5] Nagle off..." -ForegroundColor Yellow
reg add "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" /v "TCPNoDelay" /t REG_DWORD /d 1 /f | Out-Null
Write-Host " OK"
# 3. TCP autotuning — нормальный уровень (не отключен)
Write-Host "[3/5] TCP autotuning..." -ForegroundColor Yellow
netsh int tcp set global autotuninglevel=normal >$null
netsh int tcp set global rss=enabled >$null
netsh int tcp set global chimney=enabled >$null
netsh int tcp set global initialRto=2000 >$null
Write-Host " OK"
# 4. DNS — интерактивный выбор
Write-Host "[4/5] DNS..." -ForegroundColor Yellow
Write-Host ""
Write-Host " [1] Cloudflare (1.1.1.1 / 1.0.0.1)"
Write-Host " [2] Google (8.8.8.8 / 8.8.4.4)"
Write-Host " [3] Quad9 (9.9.9.9 / 149.112.112.112)"
Write-Host " [4] AdGuard (94.140.14.14 / 94.140.15.15)"
Write-Host " [5] Custom DNS (enter manually)"
Write-Host " [6] Keep current DNS"
Write-Host ""
$choice = Read-Host " Choice [1-6]"
$dns_servers = @()
switch ($choice) {
"1" { $dns_servers = @("1.1.1.1", "1.0.0.1"); $dns_name = "Cloudflare" }
"2" { $dns_servers = @("8.8.8.8", "8.8.4.4"); $dns_name = "Google" }
"3" { $dns_servers = @("9.9.9.9", "149.112.112.112"); $dns_name = "Quad9" }
"4" { $dns_servers = @("94.140.14.14", "94.140.15.15"); $dns_name = "AdGuard" }
"5" {
$custom = Read-Host " Enter DNS (primary,backup comma separated)"
$dns_servers = $custom -split "," | ForEach-Object { $_.Trim() }
$dns_name = "Custom"
}
"6" { $dns_name = "keep" }
default { Write-Host " Invalid choice - keeping current" -ForegroundColor Red; $dns_name = "keep" }
}
$ifaces = Get-NetAdapter | Where-Object {$_.Status -eq "Up"}
if ($dns_servers.Count -gt 0) {
foreach ($iface in $ifaces) {
Set-DnsClientServerAddress -InterfaceIndex $iface.InterfaceIndex -ServerAddresses $dns_servers
Write-Host " $($iface.Name) -> $($dns_servers -join ', ') ($dns_name)"
}
} else {
foreach ($iface in $ifaces) {
$dns = (Get-DnsClientServerAddress -InterfaceIndex $iface.InterfaceIndex -AddressFamily IPv4).ServerAddresses -join ", "
if ($dns) { Write-Host " $($iface.Name): $dns (kept)" }
else { Write-Host " $($iface.Name): DHCP DNS (kept)" }
}
}
ipconfig /flushdns >$null
Write-Host " DNS cache flushed"
# 5. RSS на сетевых адаптерах
Write-Host "[5/5] RSS (Receive Side Scaling)..." -ForegroundColor Yellow
foreach ($iface in $ifaces) {
Set-NetAdapterRss -Name $iface.Name -Enabled $true -MaxProcessors 4 2>$null
Write-Host " $($iface.Name): RSS ON"
}
# Сброс DNS кэша уже сделан в шаге 4
Write-Host "============================================" -ForegroundColor Cyan
Write-Host " Done" -ForegroundColor Green
Write-Host "============================================" -ForegroundColor Cyan
Write-Host ""
Write-Host "Applied:"
Write-Host " - Network throttling OFF"
Write-Host " - Nagle OFF"
Write-Host " - TCP autotuning normal + RSS + Chimney"
Write-Host " - DNS: as selected, cache flushed"
Write-Host " - RSS per core"
Write-Host ""
Write-Host "For full effect - restart your PC." -ForegroundColor Yellow