Last active
December 24, 2022 09:24
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Copie a função acima e cole no PowerShell, em seguida execute digitando o seguinte no terminal: