Networking

GRE site-to-site: large TCP uploads stall after MTU lowered when conntrack-bypass raw rule present

theocode
1mo ago
Environment

Environment

Debian 12 routers using GRE tunnel between two datacenters; original MTU 9000, recently lowered to 1500 on tunnel endpoints; iptables raw table contains a PREROUTING rule to bypass conntrack for specific traffic to improve throughput; GRE encapsulation in use; endpoints run Linux 6.x kernel.

Symptoms

Symptoms

Large TCP uploads (>1200 bytes per packet) begin transferring then throughput drops to near zero after ~30–90s; small requests and TCP handshakes succeed and short transfers complete. TCP sessions stall without immediate RST; connections eventually time out or recover after manual retry.

Observations

Observations

tcpdump on ingress shows a stream of 'Fragmentation needed' (ICMP type 3 code 4) from the far end, but those ICMP packets are not seen on the sender when the raw conntrack-bypass rule is active. When the raw rule is removed, ICMP Path MTU messages are forwarded and the large flows resume normally. Enabling explicit TCP MSS clamping on the GRE interface also restores transfers. conntrack counters show not tracked for flows matching the rule.

Already attempted

Already attempted

Disabled conntrack-bypass raw rule — problem resolved. Added -j CT --notrack to other chains with same effect. Tried lowering application MSS, set MTU smaller on endpoints — temporary fix. Allowed all ICMP in firewall — transfers resumed. Added 'TCPMSS' mangle rule on tunnel endpoint — resolved for test traffic.

Question

Question

Why does a raw PREROUTING conntrack-bypass rule cause large TCP transfers to stall over GRE after MTU changes, and what is the safest permanent fix to avoid PMTU black holes without re-enabling full conntrack for high-throughput flows?

COMMUNITY RESPONSES

Verified community troubleshooting

0 replies

No answers yet..

Showing 0 of 0 community responses
AI DIAGNOSTICS

Incident analysis

Updated 1mo ago• Trouble ID

Most likely causes

Firewall/raw PREROUTING conntrack-bypass prevents ICMP 'fragmentation needed' from being delivered or forwarded correctly, causing PMTU black hole 95%
GRE encapsulation reduced MTU but no TCP MSS clamp configured on tunnel endpoints, allowing oversized segments 70%
Kernel offload/segmentation offload combined with tunnel MTU mismatch causes large frames to be sent and dropped in-path 40%

Summary

Stalls are classic PMTU black hole behavior: ICMP 'fragmentation needed' messages are required for path MTU discovery. Raw conntrack-bypass or --notrack can prevent conntrack from associating responses with tracked flows; in some kernels or iptables setups, these bypassed packets are not subject to the normal connection tracking that would allow ICMP errors to be delivered to sockets or forwarded correctly. Additionally GRE encapsulation reduces effective MTU; if MSS is not clamped, endpoints keep sending large segments. Removing the conntrack bypass or explicitly allowing/forwarding ICMP type 3 code 4 fixed the issue in tests. TCP MSS clamping on the tunnel or reducing endpoint MTU are workarounds. Permanent fixes: allow PMTU ICMP through, add TCP MSS clamp for tunneled traffic, or adjust raw rule to exempt traffic that needs PMTU handling.

Suggested Fixes

Diagnostic step 1
Reproduce with tcpdump on both tunnel endpoints and an intermediate hop while toggling the raw PREROUTING rule to confirm ICMP delivery path.
Diagnostic step 2
Short-term safe fix: add a TCP MSS clamp on the GRE interface (iptables -t mangle -A FORWARD -p tcp --tcp-flags SYN,RST SYN -o gre+ -j TCPMSS --clamp-mss-to-pmtu) or set mtu on tunnel to 1400–1420 to avoid fragmentation.
Diagnostic step 3
If you must keep conntrack bypass, explicitly allow ICMP Type 3 Code 4 through the firewall chain used for tunnel traffic so PMTU messages reach the sender.

Continue troubleshooting

Matched from the title, description and tags