Files
bf-infra/docs/tp6-bufferbloat-messung.sh
Christoph Emsenhuber f3d8779c96 TP6-Messung ausfuehrbar machen: Skript + Anleitung fuer den Messenden
Das Messrunbook beschreibt die Methode, war aber nichts, das man jemandem in
die Hand druecken kann. Dazu jetzt zwei Artefakte:

- tp6-bufferbloat-messung.sh reproduziert die Methode von 2026-06-16
  (3 Flows Saettigung, 24 Pings idle/Last) und misst zusaetzlich die
  Download-Richtung, die damals nie gemessen wurde. Es prueft vorab die zwei
  Vorbedingungen, an denen die Messung sonst still scheitert: Default-Route
  ueber utun* = WARP-Verdacht, und mehr als eine 10.40er-Adresse = dual-homed.
  Beides nur als Warnung -- die definitive WARP-Kontrolle ist das
  Menueleisten-Icon, das kein Skript sehen kann.
  Es misst ausschliesslich und aendert nichts am Netz.

- tp6-messung-tutorial.md ist die Anleitung fuer die Person am Kabel (Geli),
  getrennt in den einfachen Browser-Weg und den exakten Skript-Weg. Das Warum
  bleibt im Runbook, hier steht nur das Machen.

Beide verweisen fuer die Auswertung auf tp6-praemisse-messrunbook.md §3/§5,
damit das Abbruchkriterium an genau einer Stelle steht.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-20 10:49:05 +02:00

88 lines
3.9 KiB
Bash
Executable File
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
#
# TP6 — Bufferbloat-Messung (reproduziert die Methode von 2026-06-16)
#
# Misst NUR. Ändert NICHTS am Netz. Läuft auf einem kabelgebundenen Client in VLAN10.
#
# Vorbedingungen (unten geprüft; die definitive WARP-Kontrolle ist das Menüleisten-Icon,
# das kann kein Skript sehen):
# 1. WARP AUS (sonst misst du den Cloudflare-Tunnel, nicht die Liwest-Leitung)
# 2. genau EIN Interface (nicht dual-homed in VLAN10 UND VLAN20)
# 3. kabelgebunden, VLAN10 (IP 10.40.10.x)
#
# Aufruf: bash tp6-bufferbloat-messung.sh
# Ergebnis: Linerate-Probe + drei Ping-Reihen (idle / Upload-Last / Download-Last).
set -uo pipefail
TARGET="1.1.1.1"
PINGS=24
SETTLE=30 # Sekunden, die die Sättigung stabil läuft, bevor gepingt wird
UPLOAD_RATE_KB=430 # ~430 KB/s je Flow × 3 = ~10,3 Mbit (wie 2026-06-16)
UPLOAD_FILE="$(mktemp -t tp6-upload).bin"
say() { printf '\n\033[1;36m== %s ==\033[0m\n' "$*"; }
warn() { printf '\033[1;33m⚠️ %s\033[0m\n' "$*"; }
say "0. Vorbedingungen"
# WARP / Default-Route: physisch (en*) = ok, utun* = VPN/WARP-Verdacht
DEFAULT_IF="$(route -n get default 2>/dev/null | awk '/interface:/{print $2}')"
if [[ "$DEFAULT_IF" == utun* ]]; then
warn "Default-Route über '$DEFAULT_IF' (utun = VPN/WARP). WARP AUSSCHALTEN, dann neu starten."
else
echo "Default-Route über '$DEFAULT_IF' — ok (physisch)."
fi
# Dual-Homing / VLAN10: genau eine 10.40.x.x-Adresse, und die muss 10.40.10.x sein
BF_IPS="$(ifconfig 2>/dev/null | grep -oE 'inet 10\.40\.[0-9]+\.[0-9]+' | awk '{print $2}')"
BF_COUNT="$(printf '%s\n' "$BF_IPS" | grep -c . || true)"
echo "BF-Adressen (10.40.x.x):"; printf '%s\n' "$BF_IPS" | sed 's/^/ /'
if [[ "$BF_COUNT" -ne 1 ]]; then
warn "$BF_COUNT BF-Adressen aktiv — dual-homed? Genau EIN Interface behalten (VLAN10)."
fi
if ! printf '%s\n' "$BF_IPS" | grep -q '^10\.40\.10\.'; then
warn "Keine 10.40.10.x-Adresse (VLAN10) — kabelgebunden in VLAN10 messen."
fi
# Upload-Datei (200 MB) anlegen
mkfile 200M "$UPLOAD_FILE" 2>/dev/null || dd if=/dev/zero of="$UPLOAD_FILE" bs=1m count=200 2>/dev/null
# Linerate-Probe: wie schnell ist der Upload wirklich? (Runbook §2.3/§5.4)
say "Linerate-Probe (10 s voller Upload)"
curl -s -o /dev/null --max-time 10 \
-w " Upload-Linerate: %{speed_upload} B/s\n" \
--data-binary @"$UPLOAD_FILE" "https://speed.cloudflare.com/__up" || true
echo " (Referenz 2026-06-16: ~1,28 MB/s = 10,3 Mbit. Deutlich mehr = Tarif geändert → Rate unten anpassen.)"
# 1. Idle-Baseline
say "1. Idle-Baseline (Netz ruhig)"
ping -c "$PINGS" "$TARGET"
# 2. Upload-Sättigung + Ping unter Last
say "2. Upload-Sättigung (3 Flows × ${UPLOAD_RATE_KB} KB/s) — ${SETTLE}s stabilisieren"
curl -s -o /dev/null --limit-rate "${UPLOAD_RATE_KB}K" --data-binary @"$UPLOAD_FILE" "https://speed.cloudflare.com/__up" & UP1=$!
curl -s -o /dev/null --limit-rate "${UPLOAD_RATE_KB}K" --data-binary @"$UPLOAD_FILE" "https://speed.cloudflare.com/__up" & UP2=$!
curl -s -o /dev/null --limit-rate "${UPLOAD_RATE_KB}K" --data-binary @"$UPLOAD_FILE" "https://speed.cloudflare.com/__up" & UP3=$!
sleep "$SETTLE"
say "2a. Ping unter Upload-Last"
ping -c "$PINGS" "$TARGET"
kill "$UP1" "$UP2" "$UP3" 2>/dev/null; wait 2>/dev/null
# 3. Download-Sättigung + Ping unter Last
say "3. Download-Sättigung (3 parallele Downloads) — ${SETTLE}s stabilisieren"
curl -s -o /dev/null "https://speed.cloudflare.com/__down?bytes=2000000000" & DL1=$!
curl -s -o /dev/null "https://speed.cloudflare.com/__down?bytes=2000000000" & DL2=$!
curl -s -o /dev/null "https://speed.cloudflare.com/__down?bytes=2000000000" & DL3=$!
sleep "$SETTLE"
say "3a. Ping unter Download-Last"
ping -c "$PINGS" "$TARGET"
kill "$DL1" "$DL2" "$DL3" 2>/dev/null; wait 2>/dev/null
rm -f "$UPLOAD_FILE"
say "Fertig"
echo "Notiere die drei min/avg/max-Zeilen (idle / Upload / Download)."
echo "Gegenprobe im Browser: https://www.waveform.com/tools/bufferbloat"
echo "Ergebnis eintragen in docs/tp6-praemisse-messrunbook.md §5."