This specification is maintained by the AgentRules Working Group. Have enhancements or want to claim maintainership?Submit Specification →
devopscritical PriorityID: cilium-ebpf-pmtu-mss-clamping-guardrail

Cilium eBPF Host-Routing Dynamic PMTU Discovery & TCP MSS Clamping Invariant

Enforces deterministic Path MTU Discovery (PMTUD) and explicit TCP MSS clamping within Cilium eBPF host-routing architectures across hybrid multi-cloud overlays. When eBPF bypasses the host Linux netfilter stack, traditional iptables TCPMSS rules become inert, causing silent packet black-holing during TCP handshakes and large payload transfers across encapsulated tunnels (Geneve/VXLAN/WireGuard). This standard mandates automated MTU derivation, tunnel overhead offsetting, and active TC/eBPF MSS clamping to prevent asymmetric drops.

Prohibited Anti-Pattern: Bypassing Netfilter with Cilium eBPF Host-Routing Without Enabling eBPF-Native PMTU and Dynamic TCP MSS Clamping

Export Ready-to-Drop Configuration

Select format below to copy code or download file directly.

---
description: Cilium eBPF Host-Routing Dynamic PMTU Discovery & TCP MSS Clamping Invariant - Enforces deterministic Path MTU Discovery (PMTUD) and explicit TCP MSS clamping within Cilium eBPF host-routing architectures across hybrid multi-cloud overlays. When eBPF bypasses the host Linux netfilter stack, traditional iptables TCPMSS rules become inert, causing silent packet black-holing during TCP handshakes and large payload transfers across encapsulated tunnels (Geneve/VXLAN/WireGuard). This standard mandates automated MTU derivation, tunnel overhead offsetting, and active TC/eBPF MSS clamping to prevent asymmetric drops.
globs: **/helm/cilium/**/values.yaml, **/cilium/**/*.yaml, **/manifests/**/cilium-config.yaml, **/terraform/**/cilium*.tf
alwaysApply: true
verified_by: "agentrules.org"
license: "CC-BY-4.0"
source: "https://agentrules.org/rules/cilium-ebpf-pmtu-mss-clamping-guardrail"
---

# Cilium eBPF Host-Routing Dynamic PMTU Discovery & TCP MSS Clamping Invariant

> **Severity**: CRITICAL | **Category**: devops
> **Anti-Pattern Warning**: Bypassing Netfilter with Cilium eBPF Host-Routing Without Enabling eBPF-Native PMTU and Dynamic TCP MSS Clamping

## System Constraints
You are a Principal Infrastructure & Network Reliability Engineer specializing in Kubernetes CNI internals and eBPF networking. Enforce strict validation on Cilium configurations where eBPF host-routing (`bpf.hostRouting: true`) is deployed across hybrid multi-cloud, transit gateways, or encapsulated overlays (Geneve/VXLAN/IPsec/WireGuard). You MUST reject configurations that rely on host netfilter iptables TCPMSS clamping or leave Cilium MTU configuration to unverified default autodetection without tunnel overhead compensation.

## Strict Guidelines
- Engineers MUST ALWAYS configure explicit encapsulation overhead margins when combining `bpf.hostRouting: true` with tunnel modes (`tunnelProtocol: vxlan` or `geneve`) or transparent encryption (`encryption.type: wireguard|ipsec`).
- Engineers MUST NOT rely on host-level `iptables -j TCPMSS --clamp-mss-to-pmtu` when eBPF host-routing is enabled, as TC-eBPF egress hooks bypass the Linux netfilter FORWARD chain entirely.
- Cilium Helm values MUST explicitly declare `bpf.pmtuDiscovery: true` (or equivalent MTU probe flag) when spanning heterogenous network paths such as AWS DirectConnect, GCP Cloud Interconnect, or multi-region Azure ExpressRoute.
- Configurations MUST calculate Pod network MTU as `Underlay Interface MTU minus Protocol Overlays` (e.g., 1500 - 50 bytes Geneve - 60 bytes WireGuard = MTU 1390) and specify this explicitly via `mtu: <calculated_value>` in `values.yaml` if dynamic discovery is constrained.
- Engineers MUST ensure ICMP Type 3 Code 4 ('Fragmentation Needed / DF set') packets are never dropped by perimeter ingress network security groups (NSGs) or CiliumNetworkPolicies across cross-cluster egress CIDRs.
- Clusters utilizing Cilium ClusterMesh MUST synchronize MTU values symmetrically across all participating clusters to prevent inter-cluster pod-to-pod TCP window collapse and silent drop hangs.

## Bad vs Good Implementations
### Vulnerable Cilium Helm Configuration (Silent Black-Holing via eBPF Bypass)

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: Enabling `bpf.hostRouting: true` causes egress packets to bypass the host kernel netfilter table where legacy iptables MSS clamping resides. Defaulting MTU to the physical interface size (1500) fails to account for tunnel encapsulation overhead, resulting in large TCP packets (TLS Client Hello, API payloads) being silently black-holed at the transit gateway.
```yaml
# values-cilium.yaml - VIOLATION
# eBPF host-routing bypasses netfilter; no PMTUD or MSS compensation configured.
routingMode: tunnel
tunnelProtocol: geneve
bpf:
  hostRouting: true
  masquerade: true
# MTU is left unset, defaulting to host eth0 MTU (1500).
# Because Geneve adds 50 bytes and WireGuard adds 60 bytes,
# packets exceeding 1390 bytes are silently dropped by intermediate hops
# because ICMP NeedFrag cannot reach the eBPF-routed endpoint.
```

#### Production Standard (Correct)
> **Standard**: Explicitly adjusts the MTU value to account for encapsulation headers, enables eBPF datapath PMTU discovery, and enforces MTU/MSS clamping directly in the Cilium datapath before packets are passed to the physical networking layer.
```yaml
# values-cilium.yaml - REMEDIATED PRODUCTION CONFIGURATION
routingMode: tunnel
tunnelProtocol: geneve

# Enforce deterministic MTU calculation accounting for 50B Geneve + 60B WireGuard overhead
# 1500 (underlay) - 50 (Geneve) - 60 (WireGuard) = 1390 MTU
mtu: 1390

bpf:
  hostRouting: true
  masquerade: true
  # Enable dynamic Path MTU Discovery tracking inside eBPF
  pmtuDiscovery: true

enablement:
  # Ensure Cilium actively probes MTU changes dynamically
  autoDirectNodeRoutes: false

# Enforce TCP MSS Clamping directly inside Cilium datapath
# (Prevents TCP segments from exceeding 1390 - 40B IPv4/TCP headers = 1350 MSS)
pmtu:
  maxRetries: 3

env:
  - name: CILIUM_ENABLE_TC_MSS_CLAMP
    value: "true"
```

Architectural Specification & Invariant Rationale

Architectural Invariant Design: Cilium eBPF Host-Routing Dynamic PMTU Discovery & TCP MSS Clamping Invariant

Cilium eBPF Host-Routing Dynamic PMTU Discovery & TCP MSS Clamping Invariant defines an industrial-grade behavioral standard for devops engineering. Enforces deterministic Path MTU Discovery (PMTUD) and explicit TCP MSS clamping within Cilium eBPF host-routing architectures across hybrid multi-cloud overlays. When eBPF bypasses the host Linux netfilter stack, traditional iptables TCPMSS rules become inert, causing silent packet black-holing during TCP handshakes and large payload transfers across encapsulated tunnels (Geneve/VXLAN/WireGuard). This standard mandates automated MTU derivation, tunnel overhead offsetting, and active TC/eBPF MSS clamping to prevent asymmetric drops. Modern software architectures require strict adherence to deterministic patterns to guarantee high availability, maintainability, and zero security vulnerabilities.

Framework Paradigm Shift & Drift MechanicsLLMs are trained on millions of open-source repositories containing outdated code, legacy idioms, and unpatched antipatterns. When coding assistants generate implementations for this stack, they default to common statistical tokens: Bypassing Netfilter with Cilium eBPF Host-Routing Without Enabling eBPF-Native PMTU and Dynamic TCP MSS Clamping Without an explicit system instruction file, developers spend hours debugging silent failures.
Failure Modes & Production Blast Radius

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 ModeAI Symptom (The Anti-Pattern)SeverityProduction Impact & Remedy
AI Hallucination & Deprecation DriftBypassing Netfilter with Cilium eBPF Host-Routing Without Enabling eBPF-Native PMTU and Dynamic TCP MSS ClampingCritical
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 InconsistencyAI 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.
Architectural Directives in Detail

Step-by-Step Production Directives

Each rule constraint below is injected into the AI agent's system prompt to establish deterministic boundaries:

1

Engineers MUST ALWAYS configure explicit encapsulation overhead margins when combining `bpf.hostRouting

Engineers MUST ALWAYS configure explicit encapsulation overhead margins when combining `bpf.hostRouting: true` with tunnel modes (`tunnelProtocol: vxlan` or `geneve`) or transparent encryption (`encryption.type: wireguard|ipsec`).

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
2

Engineers MUST NOT rely on host-level `iptables -j TCPMSS --clamp-mss-to-pmtu` when eBPF host-routing is enabled, as TC-eBPF egress hooks bypass the Linux netfilter FORWARD chain entirely.

Engineers MUST NOT rely on host-level `iptables -j TCPMSS --clamp-mss-to-pmtu` when eBPF host-routing is enabled, as TC-eBPF egress hooks bypass the Linux netfilter FORWARD chain entirely.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
3

Cilium Helm values MUST explicitly declare `bpf.pmtuDiscovery

Cilium Helm values MUST explicitly declare `bpf.pmtuDiscovery: true` (or equivalent MTU probe flag) when spanning heterogenous network paths such as AWS DirectConnect, GCP Cloud Interconnect, or multi-region Azure ExpressRoute.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
4

Configurations MUST calculate Pod network MTU as `Underlay Interface MTU minus Protocol Overlays` (e.g., 1500 - 50 bytes Geneve - 60 bytes WireGuard = MTU 1390) and specify this explicitly via `mtu

Configurations MUST calculate Pod network MTU as `Underlay Interface MTU minus Protocol Overlays` (e.g., 1500 - 50 bytes Geneve - 60 bytes WireGuard = MTU 1390) and specify this explicitly via `mtu: <calculated_value>` in `values.yaml` if dynamic discovery is constrained.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
5

Engineers MUST ensure ICMP Type 3 Code 4 ('Fragmentation Needed / DF set') packets are never dropped by perimeter ingress network security groups (NSGs) or CiliumNetworkPolicies across cross-cluster egress CIDRs.

Engineers MUST ensure ICMP Type 3 Code 4 ('Fragmentation Needed / DF set') packets are never dropped by perimeter ingress network security groups (NSGs) or CiliumNetworkPolicies across cross-cluster egress CIDRs.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
6

Clusters utilizing Cilium ClusterMesh MUST synchronize MTU values symmetrically across all participating clusters to prevent inter-cluster pod-to-pod TCP window collapse and silent drop hangs.

Clusters utilizing Cilium ClusterMesh MUST synchronize MTU values symmetrically across all participating clusters to prevent inter-cluster pod-to-pod TCP window collapse and silent drop hangs.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
Technical Questions & Answers

Frequently Asked Technical Questions

Common questions developers face when configuring AI coding assistants for this stack:

Q:Why is Cilium eBPF Host-Routing Dynamic PMTU Discovery & TCP MSS Clamping Invariant critical for AI coding assistants?

Enforces deterministic Path MTU Discovery (PMTUD) and explicit TCP MSS clamping within Cilium eBPF host-routing architectures across hybrid multi-cloud overlays. When eBPF bypasses the host Linux netfilter stack, traditional iptables TCPMSS rules become inert, causing silent packet black-holing during TCP handshakes and large payload transfers across encapsulated tunnels (Geneve/VXLAN/WireGuard). This standard mandates automated MTU derivation, tunnel overhead offsetting, and active TC/eBPF MSS clamping to prevent asymmetric drops. 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 (Bypassing Netfilter with Cilium eBPF Host-Routing Without Enabling eBPF-Native PMTU and Dynamic TCP 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.

Open Specification · CC BY 4.0·Free for Personal, Team & Commercial In-Repo Use

Citation & Open Source Attribution Guidelines

This specification is licensed under Creative Commons Attribution 4.0 International (CC BY 4.0). You are completely free to adapt and share this rule in your workspace. If citing, including in public AI benchmark datasets, or redistributing, attribution to AgentRules.org is required.

1 Rule in Stack

Cilium