Optimale MTU ermitteln
#1
in Power Shell kopieren

$target = "google.com"
$maxBuffer = 1400

# Teste in 1er-Schritten nach oben
for ($buf = 1401; $buf -le 1452; $buf++) {
    if (Test-Connection -TargetName $target -IPv6 -BufferSize $buf -DontFragment -Count 1 -ErrorAction SilentlyContinue -Quiet) {
        $maxBuffer = $buf
    } else {
        break # Stoppe beim ersten Fehler
    }
}

$optimalMtu = $maxBuffer + 48
Write-Host "--- Ergebnis ---" -ForegroundColor Green
Write-Host "Maximaler Buffer: $maxBuffer Bytes"
Write-Host "Optimale IPv6 MTU: $optimalMtu Bytes"
Zitieren
#2
oder dies auch power shell

# MTU-Testskript (nur Auswertung, korrigierte Logik)
$TargetHost = "8.8.8.8"
$InterfaceIndex = 15
$CurrentMTU = 1448

function Test-MTU {
param ([int]$PacketSize)
$ping = New-Object System.Net.NetworkInformation.Ping
$buffer = New-Object byte[] $PacketSize
$options = New-Object System.Net.NetworkInformation.PingOptions
$options.DontFragment = $true
try {
$reply = $ping.Send($TargetHost, 2000, $buffer, $options)
return $reply.Status -eq "Success"
} catch { return $false }
}

# Testbereich: 576–1500 (realistischer Bereich)
$low = 576
$high = 1500
$optimalSize = 0

Write-Host "Ermittle optimale MTU für InterfaceIndex $InterfaceIndex (aktuell: $CurrentMTU)..." -ForegroundColor Cyan

while ($low -le $high) {
$mid = [math]::Floor(($low + $high) / 2)
Write-Host "Teste Paketgröße: $mid Bytes..." -ForegroundColor DarkGray
if (Test-MTU -PacketSize $mid) {
$optimalSize = $mid
$low = $mid + 1
} else {
$high = $mid - 1
}
}

$optimalMTU = $optimalSize + 28

Write-Host "`n--- ERGEBNIS ---" -ForegroundColor Green
Write-Host "Aktuelle MTU: $CurrentMTU" -ForegroundColor Yellow
Write-Host "Optimale MTU: $optimalMTU" -ForegroundColor Green
Write-Host "`nEmpfohlener Befehl zum manuellen Setzen der MTU (falls gewünscht):" -ForegroundColor Cyan
Write-Host "Set-NetIPInterface -InterfaceIndex $InterfaceIndex -NlMtu $optimalMTU" -ForegroundColor White
Write-Host "`nHinweis: Teste die Verbindung mit 'ping -f -l $($optimalMTU-28) 8.8.8.8'!" -ForegroundColor Red
Zitieren
#3
und für linux:

#!/bin/bash

TARGET_HOST="8.8.8.8"
INTERFACE="eth0"  # Anpassen an deine Schnittstelle (z. B. eth0, ens33, wlan0)
CURRENT_MTU=$(ip link show $INTERFACE | awk '/mtu/ {print $5}')
LOW=576
HIGH=1500
OPTIMAL_SIZE=0

echo -e "\n\033[36mErmittle optimale MTU für Interface $INTERFACE (aktuell: $CURRENT_MTU)...\033[0m"

test_mtu() {
    local packet_size=$1
    if ping -c 1 -M do -s $packet_size $TARGET_HOST &> /dev/null; then




Danach:

sudo nano /etc/docker/daemon.json
sudo systemctl restart docker
Zitieren


Gehe zu:


Benutzer, die gerade dieses Thema anschauen: 1 Gast/Gäste