Skip to main content

🚀 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

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! 🌐✨

Metadata

Release files for automtu 1.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for automtu 1.1.1
File Size Uploaded
automtu-1.1.1.tar.gz 13.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for automtu 1.1.1
File Interpreter ABI Platform
automtu-1.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 27.3 kB

Release files / automtu-1.1.1.tar.gz

Download URL automtu-1.1.1.tar.gz
Size 13.2 kB
Tags Source
SHA-256 checksum
How to use checksums
59405c9f643662d0ba120d09aacc65ed9c824003c71a330d1960ef034946ae2e
BLAKE2b-256 checksum
How to use checksums
997249cbc160a9f197bb4ead1449f2dabcb63051e4327cdac4d2316fdb4c43e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.7

Release files / automtu-1.1.1-py3-none-any.whl

Download URL automtu-1.1.1-py3-none-any.whl
Size 14.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
aafaf79349c22c436ab6ae9d187ea3e53f65a99aa80d50ca8f4549b2d32181b8
BLAKE2b-256 checksum
How to use checksums
515033ccd2c156b9866692cae5a2dbe7fa5a581c633b5c66bb49ee0ccd96dd0b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.7

Release history Release notifications | RSS feed

This release

1.1.1 This release

2 release files

1.1.0

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page