KVM guests suffer one‑way UDP audio loss after nf_conntrack_udp timeout lowered on Linux NAT host
Environment
Ubuntu 22.04 host running KVM/QEMU with libvirt, guests NATed to external network via iptables MASQUERADE on host. nf_conntrack_udp_timeout has been reduced from default (30s) to 10s system-wide to try to reduce conntrack table growth.
Symptoms
VoIP and game UDP traffic from guests experiences one-way audio or packet loss after ~12 seconds of silence; after resuming traffic, audio returns but then drops again after similar intervals. ICMP pings sometimes show replies from remote but guests do not receive them intermittently.
Observations
Host conntrack entries for guest flows disappear ~10–12s after last packet when timeout is set low. Restoring default nf_conntrack_udp_timeout immediately restores stable connectivity. iptables NAT entries show mappings created but then removed when conntrack entry expires. No CPU or memory pressure observed on host.
Already attempted
Raised nf_conntrack table size; temporarily set timeout back to default which fixed the issue in quick test. Tried pinning flows with conntrack --helper but not used for these UDP flows. No asymmetric routing present; masquerade rules correct.
Question
Why do UDP flows to/from guests drop when UDP conntrack timeout is shortened, and what is the safe way to fix this while keeping conntrack resource usage reasonable?
Verified community troubleshooting
When you shorten the UDP conntrack timeout, the host removes NAT state for idle UDP flows; if a remote peer sends packets after the mapping expired, the host has nowhere to forward them and you see one‑way audio. Easiest fix: raise nf_conntrack_udp_timeout back to 30s (or 60–120s for VoIP), or implement light keepalives from guests so mappings stay alive. If conntrack memory is a concern, increase nf_conntrack_max and monitor table usage; alternatively, move guests to routed networking to avoid host NAT. All changes are reversible: set the timeout back and confirm audio stability or revert nf_conntrack_max if memory pressure appears.
Incident analysis
Most likely causes
Summary
Suggested Fixes
Continue troubleshooting
Related troubles
Matched from the title, description and tags
- Virtualization27% match
QEMU/KVM guests log 'unexpected NMI' and suffer network stalls after host resume with nested KVM enabled
Open1 answer - Linux27% match
Ubuntu 22.04 host suspend/resume breaks LXD container veth interfaces — containers lose external network
Open0 answers - Virtualization25% match
Docker overlay network MTU mismatch drops large UDP frames after cluster MTU reduced — intermittent packet loss between services
Solved1 answer - Networking23% match
Edge Linux router drops long-lived TCP uploads after conntrack table thrash under heavy NAT load
Solved1 answer - Virtualization23% match
KVM guests lose all network after host NIC firmware update under sustained I/O — MTU resets and guests show 1500-only traffic
Open0 answers