{"record":{"id":"3533588d55f72622","repo":"netbirdio/netbird","slug":"add-prerouting-wg-notrack-rule-w","errorCode":null,"errorMessage":"add prerouting wg notrack rule: %w","messagePattern":"add prerouting wg notrack rule: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/firewall/iptables/manager_linux.go","lineNumber":575,"sourceCode":"\n\twgPortStr := fmt.Sprintf(\"%d\", wgPort)\n\tproxyPortStr := fmt.Sprintf(\"%d\", proxyPort)\n\n\t// Egress rules: match outgoing loopback UDP packets\n\toutputRuleSport := []string{\"-o\", \"lo\", \"-s\", \"127.0.0.1\", \"-d\", \"127.0.0.1\", \"-p\", \"udp\", \"--sport\", wgPortStr, \"-j\", \"NOTRACK\"}\n\tif err := m.ipv4Client.AppendUnique(tableRaw, chainNameRaw, outputRuleSport...); err != nil {\n\t\treturn fmt.Errorf(\"add output sport notrack rule: %w\", err)\n\t}\n\n\toutputRuleDport := []string{\"-o\", \"lo\", \"-s\", \"127.0.0.1\", \"-d\", \"127.0.0.1\", \"-p\", \"udp\", \"--dport\", wgPortStr, \"-j\", \"NOTRACK\"}\n\tif err := m.ipv4Client.AppendUnique(tableRaw, chainNameRaw, outputRuleDport...); err != nil {\n\t\treturn fmt.Errorf(\"add output dport notrack rule: %w\", err)\n\t}\n\n\t// Ingress rules: match incoming loopback UDP packets\n\tpreroutingRuleWg := []string{\"-i\", \"lo\", \"-s\", \"127.0.0.1\", \"-d\", \"127.0.0.1\", \"-p\", \"udp\", \"--dport\", wgPortStr, \"-j\", \"NOTRACK\"}\n\tif err := m.ipv4Client.AppendUnique(tableRaw, chainNameRaw, preroutingRuleWg...); err != nil {\n\t\treturn fmt.Errorf(\"add prerouting wg notrack rule: %w\", err)\n\t}\n\n\tpreroutingRuleProxy := []string{\"-i\", \"lo\", \"-s\", \"127.0.0.1\", \"-d\", \"127.0.0.1\", \"-p\", \"udp\", \"--dport\", proxyPortStr, \"-j\", \"NOTRACK\"}\n\tif err := m.ipv4Client.AppendUnique(tableRaw, chainNameRaw, preroutingRuleProxy...); err != nil {\n\t\treturn fmt.Errorf(\"add prerouting proxy notrack rule: %w\", err)\n\t}\n\n\tlog.Debugf(\"set up ebpf proxy notrack rules for ports %d,%d\", proxyPort, wgPort)\n\treturn nil\n}\n\nfunc (m *Manager) initNoTrackChain() error {\n\tif err := m.cleanupNoTrackChain(); err != nil {\n\t\tlog.Debugf(\"cleanup notrack chain: %v\", err)\n\t}\n\n\tif err := m.ipv4Client.NewChain(tableRaw, chainNameRaw); err != nil {\n\t\treturn fmt.Errorf(\"create chain: %w\", err)","sourceCodeStart":557,"sourceCodeEnd":593,"githubUrl":"https://github.com/netbirdio/netbird/blob/93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c/client/firewall/iptables/manager_linux.go#L557-L593","documentation":"Appending the PREROUTING-chain NOTRACK rule for the WireGuard port in the iptables raw table failed. This rule stops conntrack from tracking inbound loopback UDP to the WireGuard port, which the local eBPF proxy dataplane requires; a failure here (iptables rejected the rule spec, insufficient privilege, table state changed) aborts the NOTRACK setup because without it the traffic would be NAT-tracked and misrouted.","triggerScenarios":"Thrown at client/firewall/iptables/manager_linux.go:575 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify raw table rules can be added manually as root","Check daemon capabilities and iptables backend health","Restart the daemon to retry rule installation"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c","analyzedAt":"2026-08-16T03:09:19.136Z","contentChangedAt":"2026-08-16T03:09:19.136Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}