Auto-detect egress interface, probe Path MTU, and apply MTU (WireGuard/egress).
Project description
🚀 automtu — Automatic Path MTU Detection for Linux & WireGuard
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-runis 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file automtu-1.1.0.tar.gz.
File metadata
- Download URL: automtu-1.1.0.tar.gz
- Upload date:
- Size: 12.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
27f9534c7dcddcf12436eaea1446480ba89dfcc98b4792b805526126a0c90a4a
|
|
| MD5 |
d4274b629137e3edaba2ec4cee8f1609
|
|
| BLAKE2b-256 |
e3bdb26397ab5141cec4d7ffd498e5c3e0af6e7b7e39bbf6a1b7ffcce7ba1e6e
|
File details
Details for the file automtu-1.1.0-py3-none-any.whl.
File metadata
- Download URL: automtu-1.1.0-py3-none-any.whl
- Upload date:
- Size: 13.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cbcd440c6180d30708e16ff7fea3d51c24aba05a19fd292dcdbcf3e3f53ebe9f
|
|
| MD5 |
b1a3912424c69f26ab1c6473ca3f6d2d
|
|
| BLAKE2b-256 |
68e16675f7aff7b6df283277f88fea01fbb02852173bd2663fcb818c26639414
|