Architectural Invariant Design: Cilium eBPF Host Routing MTU Clamping and WireGuard Overlay Guardrail
Cilium eBPF Host Routing MTU Clamping and WireGuard Overlay Guardrail defines an industrial-grade behavioral standard for devops engineering. Mandates automated TCP MSS clamping and explicit datapath MTU calculation when enabling Cilium WireGuard node-to-node encryption and eBPF host routing. Prevents catastrophic TCP connection stalls and silent blackholing caused by dropped ICMP Fragmentation Needed (Type 3, Code 4) packets in cloud transit VPCs. Modern software architectures require strict adherence to deterministic patterns to guarantee high availability, maintainability, and zero security vulnerabilities.
Hazard Analysis: What Breaks Without This Rule
The following failure modes have been cataloged from hundreds of hours of production code reviews where AI assistants produced non-compliant implementations:
| Failure Mode | AI Symptom (The Anti-Pattern) | Severity | Production Impact & Remedy |
|---|---|---|---|
| AI Hallucination & Deprecation Drift | Deploying Cilium WireGuard encryption on standard 1500 MTU fabrics without eBPF MSS clamping | Critical | Violating this industrial standard introduces regression bugs, security risks, and unexpected runtime failures in production. Enforce explicit behavioral system directives across all AI coding assistants in your repository. |
| Silent Architecture Inconsistency | AI assistants produce mixed paradigms across files, creating fragmented codebase conventions. | Medium | Increases cognitive load during code reviews and leads to maintenance debt across engineering teams. Pin project conventions in .cursor/rules, CLAUDE.md, and AGENTS.md so all team agents follow identical guardrails. |
Step-by-Step Production Directives
Each rule constraint below is injected into the AI agent's system prompt to establish deterministic boundaries:
Engineers MUST ALWAYS calculate and explicitly specify Cilium MTU by subtracting WireGuard overhead (minimum 60 bytes for IPv4, 80 bytes for IPv6) from the physical host interface MTU if underlay MTU auto-detection is not guaranteed.
Engineers MUST ALWAYS calculate and explicitly specify Cilium MTU by subtracting WireGuard overhead (minimum 60 bytes for IPv4, 80 bytes for IPv6) from the physical host interface MTU if underlay MTU auto-detection is not guaranteed.
Engineers MUST enable Cilium's TCP MSS clamping in the eBPF datapath (`bpf.masquerade=true` and tunnel/encryption MSS adjustment) when running cross-VPC or hybrid-cloud transit gateways that filter ICMP Type 3 Code 4.
Engineers MUST enable Cilium's TCP MSS clamping in the eBPF datapath (`bpf.masquerade=true` and tunnel/encryption MSS adjustment) when running cross-VPC or hybrid-cloud transit gateways that filter ICMP Type 3 Code 4.
Services MUST NOT rely on Path MTU Discovery (PMTUD) over intermediate cloud security groups or NAT gateways where ICMP 'Fragmentation Needed' is frequently dropped.
Services MUST NOT rely on Path MTU Discovery (PMTUD) over intermediate cloud security groups or NAT gateways where ICMP 'Fragmentation Needed' is frequently dropped.
Infrastructure code SHOULD configure `encryption.wireguard.encryptNode
Infrastructure code SHOULD configure `encryption.wireguard.encryptNode: true` only after verifying that `bpf.hostRouting` does not bypass tunnel interface routing tables unexpectedly.
Configurations NEVER allow `bpf.hostRouting
Configurations NEVER allow `bpf.hostRouting: true` alongside WireGuard without setting `mtu` explicitly or verifying that `cilium-agent` autodetects the clamped MTU on the `cilium_wg0` interface.
Frequently Asked Technical Questions
Common questions developers face when configuring AI coding assistants for this stack:
Q:Why is Cilium eBPF Host Routing MTU Clamping and WireGuard Overlay Guardrail critical for AI coding assistants?
Mandates automated TCP MSS clamping and explicit datapath MTU calculation when enabling Cilium WireGuard node-to-node encryption and eBPF host routing. Prevents catastrophic TCP connection stalls and silent blackholing caused by dropped ICMP Fragmentation Needed (Type 3, Code 4) packets in cloud transit VPCs. Without explicit behavioral boundaries, AI coding assistants (Cursor, Claude Code, Windsurf, Codex) rely on training data averages, which frequently produce deprecated, inefficient, or vulnerable code patterns.
Q:How does adopting this rule prevent AI hallucinations?
This rule explicitly declares what the AI must avoid (Deploying Cilium WireGuard encryption on standard 1500 MTU fabrics without eBPF MSS clamping) and prescribes verified positive examples. Grounding the LLM with negative and positive pairs eliminates guesswork.
Q:Which AI coding environments are supported?
This specification is multi-platform compatible: Cursor (.cursor/rules/*.mdc & .cursorrules), Anthropic Claude Code (CLAUDE.md), Windsurf (.windsurfrules), Codex / Cline (AGENTS.md), and GitHub Copilot (.github/copilot-instructions.md).
Q:Can I combine this rule with other technology stacks?
Yes. Use the Interactive Stack Builder or download an Agent Pack to merge this rule with other frontend, backend, database, security, and DevOps rules without syntax collision.