Diagnosing NAT Table Exhaustion at Home
Why conntrack fills up on consumer routers: hash table limits, nf_conntrack_max sizing, and sysctl tuning to stop NAT from silently dropping flows.

Underlined words are defined in the KBY Lexicon. Tap or click one to see what it means.
A consumer router that drops BitTorrent swarms, stutters during four-player online gaming, or cuts VoIP calls without warning is often not suffering from bandwidth starvation. A frequent root cause is NAT table exhaustion inside the kernel’s connection tracking subsystem. The WAN link has plenty of headroom, CPU utilisation looks fine in the vendor dashboard, yet new outbound flows simply fail to establish. What follows covers the netfilter conntrack architecture that underpins Linux-based consumer-grade NAT, how to instrument it properly, and how to retune it before it becomes a silent, unmonitored single point of failure.
#Why new connections fail once the table fills
This article applies to Linux-based routers: stock vendor firmware built on Linux, OpenWrt, or a bare-metal Linux box. These implement NAT via the Linux kernel’s netfilter conntrack module. pfSense is not covered by the Linux steps below: it is built on FreeBSD and uses pf with its own state table (see the pfSense note under the occupancy checks below). Every flow that traverses the NAT boundary (TCP, UDP, or ICMP) requires an entry in an in-kernel hash table so that return traffic can be correctly de-multiplexed back to the originating internal host. That table has a hard upper bound, nf_conntrack_max, and on most off-the-shelf routers this value is set very low relative to modern usage patterns: browsers holding dozens of keep-alive HTTP/2 connections, IoT devices polling cloud brokers every few seconds, and peer-to-peer applications opening hundreds of short-lived UDP sockets simultaneously.
Once the table fills, new flows cannot be tracked and the kernel drops the packet that would have created the new entry (typically logging “table full, dropping packet”). Nothing useful is signalled to the application, which just sees a connection that never completes its handshake. This is why NAT table exhaustion is so difficult to triage from a home user’s perspective: the symptom looks identical to packet loss, DNS failure, or an overloaded CPU, but none of the conventional diagnostics point at the actual bottleneck.
#How conntrack stores each flow
The conntrack subsystem maintains a hash table where each bucket resolves to a linked list of struct nf_conn entries. Each entry stores the 5-tuple (protocol, source IP, source port, destination IP, destination port) for both the original and reply direction, along with protocol-specific state: ESTABLISHED, SYN_SENT, TIME_WAIT for TCP, or a simple timeout counter for UDP and ICMP. This is fundamentally a stateful, in-memory data structure, and like any hash table it has two independent scaling constraints:
- The bucket count (
nf_conntrack_buckets), which sets the hash collision rate and lookup latency. - The maximum entries (
nf_conntrack_max), the hard ceiling on total tracked flows regardless of bucket distribution.
Unless firmware overrides it, current kernels size the table from RAM, with nf_conntrack_max equal to the hash bucket count and a floor of 1024, so the limited RAM found in embedded router SoCs (often 128–256MB total) yields a ceiling of only about 2048–4096 entries on a 32-bit SoC. Vendor firmware may set its own value, so check the running one. Each struct nf_conn consumes roughly 300–350 bytes depending on kernel version and enabled extensions (NAT, timeout, helper), so even doubling the table to 16384 entries costs under 6MB of RAM: trivial on modern hardware, but a real constraint on a decade-old embedded board.
Engineers face the same limit with any bounded resource pool in distributed systems (connection pools, thread pools, file descriptor limits), and the same architectural patterns used to reason about backpressure in application-layer services apply directly to kernel-level NAT state.
#Timeout Policy and Garbage Collection
Entries are not removed proactively when a flow ends cleanly; the kernel relies on protocol-specific timeouts and a garbage collector that walks the table periodically. TCP has multiple state-dependent timeouts, and nf_conntrack_tcp_timeout_established has an upstream kernel default of 432000 seconds (5 days), which is very long for a home gateway and a major contributor to table bloat from long-lived idle connections (background sync clients, persistent WebSocket sessions, smart TVs). OpenWrt and vendor firmware may ship different values, so check the running value. UDP, lacking any explicit teardown signal, defaults to a 30-second unreplied timeout and a 120-second timeout once traffic has been seen in both directions (stream/assured). That is short enough to break NAT traversal for VoIP and WebRTC media streams that briefly pause during silence suppression, so do not shorten these values on networks carrying such traffic.
#Checking how full the table is
Before touching any sysctl values, establish a baseline. On a Linux-based router (OpenWrt or a bare-metal Linux box) the current occupancy and ceiling are exposed directly via procfs:

1cat /proc/sys/net/netfilter/nf_conntrack_count
2cat /proc/sys/net/netfilter/nf_conntrack_max
3
4# ratio approaching 1.0 confirms table pressure
5echo "scale=2; 100*$(cat /proc/sys/net/netfilter/nf_conntrack_count)/$(cat /proc/sys/net/netfilter/nf_conntrack_max)" | bcpfSense: pfSense uses pf, not netfilter, so none of the paths or sysctls in this article exist there. Check state usage with pfctl -si (current entries) and pfctl -sm (limits), and adjust the limit under System > Advanced > Firewall & NAT (Firewall Maximum States / Table Entries).
Confirm the correlation against kernel logs. A saturated table normally logs a message like the one below, which is strong evidence of exhaustion. The message can be rate-limited or have rotated out of the ring buffer, so its absence does not rule exhaustion out; also check the drop and insert_failed counters in conntrack -S:
1dmesg | grep -i conntrack
2# nf_conntrack: table full, dropping packet
3conntrack -SFor a live breakdown by protocol and state, the userspace conntrack tool (from conntrack-tools) is more informative than raw procfs counters:
1conntrack -L | awk '{print $1}' | sort | uniq -c | sort -rn
2# 2841 tcp
3# 1122 udp
4# 34 icmpIf TCP entries dominate and a large proportion sit in TIME_WAIT or ESTABLISHED for hours, the fix is timeout tuning rather than raw table expansion. If UDP dominates and correlates with peer-to-peer or gaming traffic, the fix is closer to raising nf_conntrack_max while leaving UDP timeouts at their defaults, since shortening them can break VoIP and gaming traffic.
#Raising the ceiling and shortening the timeouts
The correct fix is rarely a single sysctl flip; it is a coordinated adjustment of bucket count, ceiling, and timeout policy sized against available RAM. A reasonable target for a home gateway with 512MB+ of RAM is 65536 tracked connections, which comfortably covers dense multi-device households running torrent clients, game consoles, and IoT hubs concurrently. Size the buckets from the ceiling: set the bucket count to roughly nf_conntrack_max divided by 4 to 8 (65536 / 4 = 16384 buckets). Pilot the change on one router before rolling it out to others.
1## /etc/sysctl.d/99-conntrack.conf
2net.netfilter.nf_conntrack_max = 65536
3net.netfilter.nf_conntrack_tcp_timeout_established = 86400
4net.netfilter.nf_conntrack_tcp_timeout_time_wait = 30
5net.netfilter.nf_conntrack_generic_timeout = 60A one-day established timeout still reclaims idle entries far sooner than the 5-day default. Going lower (for example 3600) will drop idle-but-live connections such as SSH sessions and long-polling clients unless those clients send TCP keepalives more often than the timeout, so only shorten it after confirming keepalive settings on the clients.
Note that nf_conntrack_buckets is sized when the hash table is allocated. Current kernels let you change it at runtime (the sysctl is writeable only in the initial network namespace, and older kernels expose it read-only), but a runtime change does not survive a reboot: persist it as a module parameter, via the kernel command line where the module is compiled in, or, on OpenWrt, via a file in /etc/modules.d/.
Resizing the bucket table is disruptive, so do it from a console (not over the connection you depend on) during a maintenance window. Do not unload nf_conntrack on a live router: it drops all tracked connections and usually fails with “module in use” while NAT rules reference it. Record the current values first, then change the bucket count at runtime through the module parameter, and make it persistent with a module option or kernel command line:
1# Record current values for rollback
2sysctl net.netfilter.nf_conntrack_max net.netfilter.nf_conntrack_tcp_timeout_established
3cat /sys/module/nf_conntrack/parameters/hashsize
4
5# Resize buckets at runtime (max / 4)
6echo 16384 > /sys/module/nf_conntrack/parameters/hashsize
7
8# Apply the sysctl file (or set values one at a time with sysctl -w)
9sysctl --system
10
11# Verify
12sysctl net.netfilter.nf_conntrack_max
13cat /sys/module/nf_conntrack/parameters/hashsizeTo persist the bucket count on a distribution that loads the module from modprobe configuration, add a line such as the following (or the equivalent nf_conntrack.hashsize=16384 on the kernel command line when the module is built in). On OpenWrt, check how your release passes module parameters in /etc/modules.d/ before relying on this:
1## /etc/modprobe.d/nf_conntrack.conf
2options nf_conntrack hashsize=16384To revert, write the recorded values back with sysctl -w and the hashsize file, or remove the files you created and reboot. Keep console access until you have confirmed the router still passes traffic.
Verify the new ceiling takes effect before declaring the fix complete. A common mistake is editing sysctl.conf without reloading, leaving the running kernel on its original defaults until the next reboot masks the actual root cause.
#Cases that make exhaustion harder to spot
NAT table exhaustion rarely fails cleanly, and several edge cases compound the diagnostic difficulty:
Asymmetric hairpin NAT. When two internal hosts communicate via the router’s public IP (common with self-hosted services referenced by external DNS), the router both destination-NATs and source-NATs each connection. Netfilter keeps both translations in that connection’s single conntrack entry, so hairpinned flows cost extra NAT processing rather than extra table entries, but busy internal services still add to table pressure like any other flow.

Protocol helper modules. Application-layer gateway helpers (nf_conntrack_ftp, nf_conntrack_sip) parse payload data to track secondary connections such as FTP data channels. These helpers expand the attack surface significantly, since they parse untrusted payload inside kernel space, and have historically been a source of CVEs. Disabling unused helpers is both a performance and security improvement.
SYN flood amplification. Because every SYN packet, legitimate or spoofed, creates a provisional conntrack entry in SYN_SENT state before the handshake completes, a modest SYN flood against any internal host can exhaust the entire table well before it saturates WAN bandwidth. This is functionally a denial-of-service vector distinct from bandwidth-based attacks, and raising nf_conntrack_max alone without also tightening nf_conntrack_tcp_timeout_syn_sent (default 120s) makes the router more vulnerable, not less.
UDP bindings that expire mid-call. WebRTC and VoIP clients rely on periodic keep-alives to hold NAT bindings open. If nf_conntrack_udp_timeout_stream is shorter than the application’s keep-alive interval, the binding is reclaimed mid-call, and the remote peer’s media packets simply vanish: no error, just silence on the line.
#What each change costs in memory and exposure
Retuning the conntrack table has a price. Every adjustment trades memory, latency, or attack surface against throughput, and the correct values depend heavily on the deployment context: a single-family home gateway has very different requirements to a small-office router serving forty devices.
- Memory vs concurrency: each additional 10,000 tracked entries costs roughly 3–3.5MB of RAM; trivial on modern hardware but a real constraint on sub-256MB embedded routers, where over-provisioning the table can trigger OOM killer activity elsewhere in the system.
- Short timeouts vs premature drops: aggressively shortening
tcp_timeout_establishedreclaims table space faster but risks dropping legitimately idle-but-active connections such as SSH sessions or long-polling API clients, forcing unnecessary reconnections. - Helper modules vs attack surface: enabling protocol helpers restores compatibility with legacy protocols like FTP but reintroduces kernel-space payload parsing as a security liability; prefer application-layer proxies where possible instead of ALGs.
- Large tables vs SYN flood resilience: a larger
nf_conntrack_maxabsorbs more legitimate concurrent flows but also absorbs more attacker-controlled provisional entries during a SYN flood, meaning table size increases should always be paired with tightenedSYN_SENTandSYN_RECVtimeouts, never applied in isolation. - Stateful NAT vs stateless forwarding: for the highest-throughput links, some engineers bypass conntrack entirely using stateless nftables rules for known-safe flows, trading connection tracking overhead for the loss of automatic reply-path handling, which is acceptable only where routing symmetry is guaranteed.
Full detail on every tunable, including kernel-version-specific defaults and interactions with NAT extensions, is documented in the official Linux kernel netfilter conntrack sysctl reference, which should be treated as the authoritative source before deploying any of the values above in production firmware.
Treat the conntrack table with the same operational rigour applied to any bounded resource pool: instrument it, alert on saturation thresholds well before 100%, and size it deliberately against both available memory and realistic peak concurrency rather than accepting vendor defaults tuned for a decade-old hardware baseline.
#Related reading
Evidence trail
Sources and verification
Primary documentation and external technical references used in this article.
About this page
Credited to
Dates
Published
Last updated
Was this useful?
Reports go to the site owner and are used to correct pages. Corrections are listed at /corrections.
Engineering insights, direct to you.
Receive the latest Systems Engineering tutorials, production guides, Engineering Labs and operational best practices.
Comments
Add a thoughtful note on Diagnosing NAT Table Exhaustion at Home. Comments are checked for spam and held for moderation before appearing.