Skip to main content

Auto-detect egress interface, probe Path MTU, and apply MTU (WireGuard/egress).

Project description

🚀 automtu — Automatic Path MTU Detection for Linux & WireGuard

GitHub Sponsors Patreon Buy Me a Coffee PayPal

automtu is a small but powerful CLI tool that automatically detects your egress interface, probes the Path MTU (PMTU), computes a safe MTU for WireGuard, and optionally applies it — or simply prints it for automation tools like Ansible.

Perfect for:

  • Docker-in-Docker (DiD)
  • WireGuard tunnels
  • Cloud VPS setups
  • CI runners
  • NAT / overlay networks

No more TLS handshake timeouts. No more guessing MTU values. Just reliable networking. ✅


✨ Features

  • 🔍 Auto-detects your egress interface (eth0, ens3, etc.)
  • 📡 Probes Path MTU using DF-ping (ping -M do)
  • 🧮 Computes a safe WireGuard MTU (effective_mtu - overhead)
  • 🔐 Supports WireGuard peer auto-discovery
  • ⚙️ Optional automatic MTU application
  • 🤖 Machine-readable output for Ansible / CI
  • 📦 JSON output for automation pipelines
  • 🧪 Fully unit-tested

📦 Installation

Option 1 — Install via pip (recommended)

pip install automtu

or editable mode for development:

pip install -e .

Option 2 — Local installation from source

git clone https://github.com/kevinveenbirkenbach/automtu.git
cd automtu
pip install -e .

Now the automtu command is available system-wide.


🚦 Usage

🔍 Show detected MTU (no changes)

automtu --dry-run

📡 Probe PMTU and apply to egress interface

sudo automtu --pmtu-target 1.1.1.1 --apply-egress-mtu

🔐 Auto-detect WireGuard peers and apply WG MTU

sudo automtu --auto-pmtu-from-wg --apply-wg-mtu

⚡ Prefer WireGuard as egress if default route uses wg0

sudo automtu --prefer-wg-egress --auto-pmtu-from-wg --apply-wg-mtu

🧮 Print only the MTU number (for Ansible & scripts)

automtu --print-mtu effective

Output:

1452

Perfect for:

- name: Detect MTU
  command: automtu --print-mtu effective
  register: mtu

- name: Apply MTU
  command: ip link set mtu {{ mtu.stdout }} dev eth0

📤 JSON output (CI / automation)

automtu --print-json

Output:

{
  "egress": { "iface": "eth0", "base_mtu": 1500, "effective_mtu": 1452 },
  "pmtu": { "policy": "min", "chosen": 1452 },
  "wg": { "iface": "wg0", "mtu": 1372 },
  "dry_run": true
}

🛡 Notes

  • Applying MTU requires root (sudo) unless --dry-run is used
  • PMTU probing may fail if ICMP is blocked — fallback is automatic
  • MTU changes are runtime-only (not persistent across reboot)

🧠 Why automtu?

Because networking stacks are layered, tunneled, NATed and virtualized. Path MTU matters — especially for:

  • Docker-in-Docker
  • VPN tunnels
  • Cloud providers
  • Kubernetes nodes
  • CI runners

automtu removes guesswork and prevents hard-to-debug TLS timeouts.


👤 Author

Kevin Veen-Birkenbach 🌍 https://www.iveen.world

Open Source, Automation, Infrastructure & Digital Sovereignty.


❤️ Support

If automtu helped you, consider supporting the project:

  • ⭐ Star on GitHub
  • ☕ Buy Me a Coffee
  • 💙 GitHub Sponsors

Happy networking! 🌐✨

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

automtu-1.0.0.tar.gz (10.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

automtu-1.0.0-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

Details for the file automtu-1.0.0.tar.gz.

File metadata

  • Download URL: automtu-1.0.0.tar.gz
  • Upload date:
  • Size: 10.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for automtu-1.0.0.tar.gz
Algorithm Hash digest
SHA256 d59fa60a627251e77907cc4f4bf5c7eeb43f222d7bcf1ed0d6cf9f8dfc4fec0d
MD5 25840508d6b081a9536778d3cc468488
BLAKE2b-256 3af8a018a7b02c7ad1b7455a8d050737e3938ac6a357674de76f01e435a7cc51

See more details on using hashes here.

File details

Details for the file automtu-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: automtu-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 10.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for automtu-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 18d3fa84854bfccfd26ba173948f19986f59c022cafae5e09eea60bed20f2569
MD5 24e5d03a40dbed9c08458b964eee4fc2
BLAKE2b-256 80f44407400d902660db6cbb68f04c1274d0320e0840ea80c22eca36c357fdf8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page