mtu-warden is a production-grade Linux MTU controller for WAN and tunnel-heavy servers.
It is designed for operators who need deterministic MTU behavior in real-world anti-DDoS, overlay, and mixed datacenter environments, while staying safe by default: no route mutation, no blind mass-editing, and clear rollback state.
mtu-warden provides a full operational cycle:
- Detect interfaces and classify transport/tunnel roles.
- Recommend safe WAN and per-tunnel MTUs from PMTU probing and overhead models.
- Apply MTU and MSS clamp changes idempotently.
- Persist state and rollback exactly what was changed.
MTU failures are often subtle:
- TCP handshakes work but data stalls.
- Some destinations fail while others succeed.
- Tunnel control plane appears healthy while payload traffic fragments or blackholes.
mtu-warden replaces brittle one-off scripts with a repeatable and auditable workflow.
- Operators running anti-DDoS paths where PMTU behavior changes under mitigation
- Teams managing mixed tunnel stacks (WireGuard, GRE, L2TPv3, VXLAN/Geneve, IPIP/SIT, VTI)
- SRE/NetOps teams who need safe idempotent reconciliation and rollback instead of ad-hoc shell scripts
- Providers or self-hosters who want deterministic MTU policy across reboot and interface churn
- Safe default WAN detection via
ip route get 1.1.1.1 - Structured interface classification and conservative filtering
- Profile-driven MTU policy for WAN and multiple tunnel families
tunnel_patternsmapping for custom interface naming (including backhaul layouts)- PMTU recommendation with bounded binary-search probing and retries
- MSS clamp management with backend autodetect (
nftablespreferred,iptablesfallback) - Idempotent firewall rule handling (no duplicate clamp rules)
- Conservative firewall ownership: only
mtu-warden-managed iptables clamp rules are removed - Stateful rollback in
/var/lib/mtu-warden/state.json - Systemd oneshot + timer reconciliation for interfaces appearing after boot
- Structured logs with TTY-aware color and plain non-interactive output
- GRE
- GRETAP
- IP6GRE
- ERSPAN
- L2TPv3 UDP encapsulation
- L2TPv3 IP encapsulation
- WireGuard
- VXLAN
- Geneve
- IPIP
- SIT
- VTI/IPsec
- PPP/PPPoE-style interfaces
- Backhaul patterns via profile-defined
tunnel_patterns
Backhaul note: when a backhaul product does not create a dedicated kernel tunnel interface, mtu-warden still manages WAN MTU and MSS clamping safely, and can target additional interfaces through include_patterns and tunnel_patterns.
Supported targets:
- Ubuntu
20.04,22.04 - Debian
11,12
Install:
sudo bash scripts/install.shInstall and enable timer:
sudo bash scripts/install.sh --enable-timerInstall behavior:
- Idempotent and safe to rerun
- Installs/upgrades required dependencies only
- Never runs
dist-upgradeorfull-upgrade - Never removes packages
- Preserves existing
/etc/mtu-wardenconfiguration - Installs binary to
/usr/local/sbin/mtu-warden - Installs systemd units, enables timer only when requested
Dependency check:
bash scripts/check-deps.shmtu-warden statusmtu-warden detectmtu-warden recommend --profile parsabrsudo mtu-warden apply --profile parsabr --yesBuilt-in profiles:
parsabrgeneric-iran-antiddoshetznerovhcustom
Runtime overrides:
- Directory:
/etc/mtu-warden/profiles.d/*.toml - Override model: file/profile name matches built-in profile name, fields merge safely
Key profile fields:
wan_mtu- Per-tunnel MTUs:
gre_mtu,gretap_mtu,ip6gre_mtu,erspan_mtu,l2tp_udp_mtu,l2tp_ip_mtu,wg_mtu,vxlan_mtu,geneve_mtu,ipip_mtu,sit_mtu,vti_mtu,ppp_mtu,backhaul_mtu mss_clamp_oninclude_patterns/exclude_patterns[tunnel_patterns][overhead_overrides]
Read-only recommendation report:
mtu-warden recommend --profile parsabrJSON output:
mtu-warden recommend --profile parsabr --jsonCustom probe targets:
mtu-warden recommend --profile parsabr --ipv4-host 1.1.1.1 --ipv6-host 2606:4700:4700::1111Preview changes without mutation:
sudo mtu-warden --dry-run apply --profile parsabr --yesApply profile non-interactively:
sudo mtu-warden apply --profile parsabr --yesManual one-interface operation:
sudo mtu-warden set --iface wg0 --mtu 1320 --mss-clamp on --yesRollback the last persisted operation:
sudo mtu-warden rollback --yesRollback preview:
sudo mtu-warden --dry-run rollback --yesShipped units:
packaging/systemd/mtu-warden.servicepackaging/systemd/mtu-warden.timer
Timer defaults:
OnBootSec=30OnUnitActiveSec=2min
Manual timer control:
sudo systemctl daemon-reloadsudo systemctl enable --now mtu-warden.timersudo systemctl status mtu-warden.timerCheck current state:
mtu-warden statusRe-run recommendation:
mtu-warden recommend --profile generic-iran-antiddosValidate interface classification:
mtu-warden detect --profile parsabrConfirm dependencies:
bash scripts/check-deps.shIf PMTUD remains unstable:
- Verify ICMP fragmentation-needed handling on upstream path.
- Keep MSS clamp enabled for affected path segments.
- Re-run recommendation after provider or routing-path changes.
apply,set, androllbackare mutating commands and should run with root privileges.status,detect, andrecommendare safe read-oriented operations.--dry-runavoids system mutation for mutating commands.- MTU guardrail is enforced (
576..9216). - Routes are never changed by
mtu-warden.
mtu-warden is release-ready for v1.0.0 with production-focused defaults, rollback, idempotent firewall management, and timer-based reconciliation.
Licensed under GNU GPLv3. See LICENSE.
Maintained by YrustPd.
- GitHub: https://github.com/YrustPd
- Project: https://github.com/YrustPd/mtu-warden
- Issues: https://github.com/YrustPd/mtu-warden/issues
- Maintainer profile: https://github.com/YrustPd