Why nftables dropped my VPN traffic and how to fix it

When I first switched from iptables to nftables in early 2026, I expected a cleaner rule set and better performance. Instead, my OpenVPN client on a Debian 12 host stopped receiving any packets after the firewall rebooted. The packets were being dropped silently—no log entry, no obvious error. The culprit turned out to be a subtle default in nftables that treats unknown protocols as “reject” rather than “accept”. Below is a step‑by‑step diagnosis and a set of practical fixes that keep your VPN secure without opening a hole in the firewall.


1. The default “reject” behaviour

In nftables every chain has a policy that applies when no rule matches.
The default policy is accept for the filter table, but the nat and mangle tables default to reject. When you create a new table without specifying a policy, nftables falls back to the kernel’s default, which is reject for packets that don’t match any rule. This is a safety feature that protects against accidental exposure of services.

When I added a minimal filter table for the VPN:

nft add table inet vpn
nft add chain inet vpn input { type filter hook input priority 0 \; policy accept \; }

I omitted the policy accept line. The kernel applied its default reject policy, so every packet that didn’t hit an explicit rule was dropped. Since OpenVPN uses UDP on port 1194 and a few control packets on TCP 443 for fallback, those packets never matched any rule and were silently rejected.


2. Detecting the silent drop

The first clue was the absence of logs. By default, nftables does not log rejected packets unless you explicitly add a log rule. To see what was happening, I enabled a temporary log rule:

nft add rule inet vpn input ip protocol udp log prefix "nft-drop: " counter

After restarting OpenVPN, the kernel produced a flood of nft-drop log entries for UDP 1194. The log showed the packet was being dropped by the chain’s policy, not by an explicit rule.


3. Fixing the policy

The simplest fix is to set an explicit accept policy on the chain that handles VPN traffic:

nft add chain inet vpn input { type filter hook input priority 0 \; policy accept \; }

If you already have a chain, just modify it:

nft change chain inet vpn input policy accept

This tells nftables to allow any packet that doesn’t match a rule, which is what you want for a VPN that should accept all inbound traffic from the VPN client.


4. Adding explicit allow rules

While a permissive policy is fine for a dedicated VPN interface, it’s safer to be explicit about which traffic you allow. A common pattern is:

nft add rule inet vpn input iifname "tun0" ct state established,related accept
nft add rule inet vpn input iifname "tun0" ip protocol udp udp dport 1194 accept
nft add rule inet vpn input iifname "tun0" ip protocol tcp tcp dport 443 accept

These rules:

  1. Accept established/related connections (the return traffic from the VPN server).
  2. Allow the OpenVPN control channel on UDP 1194.
  3. Allow fallback TCP 443 if you use proto udp with remote-cert-tls server and tls-auth.

If you use a different interface name or port, adjust accordingly.


5. Avoiding the “unknown protocol” trap

Some VPN clients use GRE or ESP (IP protocol 47/50) for encapsulation. If you forget to allow those, the packets will be dropped. Add:

nft add rule inet vpn input iifname "tun0" ip protocol 47 accept
nft add rule inet vpn input iifname "tun0" ip protocol 50 accept

If you’re running WireGuard, you’ll need to allow UDP 51820 and the kernel’s ip6tables rules for IPv6.


6. Persisting the rules

Unlike iptables, nftables does not automatically reload rules on reboot unless you use a systemd unit or a distribution‑specific service. On Debian, the nftables package ships with /etc/nftables.conf. Add your rules there:

#!/usr/sbin/nft -f

table inet vpn {
    chain input {
        type filter hook input priority 0; policy accept;
        iifname "tun0" ct state established,related accept
        iifname "tun0" ip protocol udp udp dport 1194 accept
        iifname "tun0" ip protocol tcp tcp dport 443 accept
        iifname "tun0" ip protocol 47 accept
        iifname "tun0" ip protocol 50 accept
    }
}

Then enable the service:

systemctl enable nftables
systemctl restart nftables

7. Trade‑offs and hardening tips

ApproachProsCons
Accept policy + explicit rulesClear intent, minimal rule setStill accepts any packet that matches the interface
Reject policy + explicit allowStrict by default, easier to auditRequires more rules, risk of missing a needed rule
Logging every dropImmediate visibilityLog spam, potential DoS if misconfigured

For most VPN deployments, the “accept policy + explicit allow” pattern is a good balance. It keeps the firewall simple while still allowing you to audit which ports are exposed.

If you’re hardening a server that also serves web services, consider placing the VPN chain before the public chains, so that VPN traffic bypasses the stricter rules applied to the external interface.


8. Common pitfalls

SymptomLikely causeFix
VPN client shows “Connection refused”Policy reject on chainSet policy accept or add explicit allow
No logs for dropped packetsNo log ruleAdd a temporary log rule to diagnose
VPN works after nft flush chainCached rules missingEnsure rules are persisted in /etc/nftables.conf
VPN drops after rebootService not enabledsystemctl enable nftables

9. Quick checklist

  1. Verify interface name (ip a).
  2. Set chain policy to accept or reject as desired.
  3. Add explicit allow rules for VPN protocols and ports.
  4. Persist the configuration in /etc/nftables.conf.
  5. Enable the nftables service.
  6. Test with nft list ruleset and tcpdump -i tun0.

10. Final thoughts

The drop I experienced was a classic case of a missing policy in nftables. The kernel’s default “reject” is a good safety net, but it can bite when you’re migrating from iptables. By explicitly setting the policy and adding a handful of allow rules, you can keep your VPN traffic flowing while maintaining a clean, auditable firewall.

For more details on nftables syntax and best practices, the official documentation is a great reference: https://docs.kernel.org/netfilter/nftables/index.html.

See also