Edge Linux router drops long-lived TCP uploads after conntrack table thrash under heavy NAT load
Environment
Edge router: Debian-based appliance (custom iptables netfilter stack), single public IPv4 WAN, many internal clients NAT'ed to public address, nf_conntrack default hashsize, nf_conntrack_max tuned low by vendor script; large concurrent uploads to cloud over HTTPS from multiple hosts during backup window.
Symptoms
Long-running TCP uploads (SCP/HTTPS multipart PUTs) stall after 20–90s: application shows stalled progress though TCP connection stays ESTABLISHED; smaller requests complete normally. Throughput intermittently drops to near-zero for specific flows and sometimes resumes after 60–120s.
Observations
dmesg intermittently reports 'nf_conntrack: table full' and 'nf_conntrack: DROP' messages; /proc/sys/net/netfilter/nf_conntrack_count approaches nf_conntrack_max during peaks; conntrack entries show many short-lived entries and frequent hashchain rehash attempts. No obvious interface errors; increasing nf_conntrack_max temporarily reduces frequency of stalls.
Already attempted
Raised nf_conntrack_max to a higher value live (sysctl), disabled some NAT helpers, added more memory to router, temporarily enabled raw table bypass for trusted hosts — stalls reduced but not eliminated under peak load. Router firmware recently reduced default hashsize on boot by vendor script.
Question
What is causing TCP flows to stall mid-upload when conntrack table gets busy, and how can I make long-lived uploads reliable without disabling NAT or dramatically increasing memory usage?
Verified community troubleshooting
Start by checking nf_conntrack usage while the issue happens: cat /proc/sys/net/netfilter/nf_conntrack_count and compare to nf_conntrack_max. If the count nears the max and dmesg shows 'table full', raise nf_conntrack_max and adjust conntrack buckets (nf_conntrack_buckets) so the hash table isn't overloaded. Also tune tcp timeout values so established transfers aren’t evicted prematurely. As a targeted mitigation, NOTRACK long-lived backup hosts via raw table so those flows bypass conntrack. Verify by running an upload and watching /proc/net/nf_conntrack entries and tcpdump to ensure NAT mappings remain. Revert sysctl changes if other services break.
Incident analysis
Most likely causes
Summary
Suggested Fixes
Continue troubleshooting
Related troubles
Matched from the title, description and tags
- Networking24% match
GRE tunnel drops fragmented packets >1400B only when raw PREROUTING conntrack-bypass rule is present on Linux router
Open0 answers - Networking24% match
Clients receive IPv6 addresses but no default route after enabling DHCPv6-only mode on OpenWrt router
Open0 answers - Networking21% match
Large TCP uploads stall over WireGuard after MTU lowered on Linux server
Open0 answers - Networking21% match
Large TCP uploads stall over WireGuard peer after MTU reduction on Linux server
Open0 answers - Networking20% match
Clients time out to IPv4-only sites after enabling DNS64/NAT64 on OpenWrt router (intermittent synthesis failures)
Open0 answers