Skip to content

Instantly share code, notes, and snippets.

@zenojunior
Last active December 24, 2022 09:24
Show Gist options
  • Select an option

  • Save zenojunior/7785f828bfbf9758a8f1e833b316df27 to your computer and use it in GitHub Desktop.

Select an option

Save zenojunior/7785f828bfbf9758a8f1e833b316df27 to your computer and use it in GitHub Desktop.
Script para encontrar o MDU ideal para conexão através do PowerShell
function FindIdealMtu() {
$target = 'google.com'
$min = 0
$max = 1500
while ($min -le $max) {
$mid = [Math]::Floor(($min + $max) / 2)
$packetSize = $mid - 28
if ($packetSize -lt 0) {
$packetSize = 0
}
$res = Test-Connection $target -BufferSize $packetSize -Count 1 -Quiet
if ($res) {
$min = $mid + 1
$mtu = $packetSize
} else {
$max = $mid - 1
}
}
Write-Output "MTU ideal para a conexão: $mtu bytes"
}
@zenojunior
Copy link
Author

Copie a função acima e cole no PowerShell, em seguida execute digitando o seguinte no terminal:

FindIdealMtu

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment