netbirdio/netbird · error
delete output DNAT rule
Error message
delete output DNAT rule: %w
What it means
RemoveOutputDNAT failed to delete the previously installed OUTPUT-chain DNAT rule from the nat table. The in-memory rule entry is kept when deletion fails so the map still reflects what is in the kernel, allowing a later retry; the caller gets this error to signal that the port translation is still active.
Solutions
- Manually remove the leftover OUTPUT DNAT rule
- Restart the daemon for reconciliation
- Fix the underlying iptables issue
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at client/firewall/iptables/router_linux.go:1108 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of netbirdio/netbird@93e97f4bf1 (2026-08-16).
Data as JSON: /api/errors/efe3cc33ee4e9998.
Report an issue: GitHub.
Appendix: source
Thrown at client/firewall/iptables/router_linux.go:1108
"--to-destination", ":" + strconv.Itoa(int(translatedPort)),
}
if err := r.iptablesClient.Append(tableNat, chainNATOutput, dnatRule...); err != nil {
return fmt.Errorf("add output DNAT rule: %w", err)
}
r.rules[ruleID] = dnatRule
r.updateState()
return nil
}
// RemoveOutputDNAT removes an OUTPUT chain DNAT rule.
func (r *router) RemoveOutputDNAT(localAddr netip.Addr, protocol firewall.Protocol, originalPort, translatedPort uint16) error {
ruleID := fmt.Sprintf("output-dnat-%s-%s-%d-%d", localAddr.String(), protocol, originalPort, translatedPort)
if dnatRule, exists := r.rules[ruleID]; exists {
if err := r.iptablesClient.Delete(tableNat, chainNATOutput, dnatRule...); err != nil {
return fmt.Errorf("delete output DNAT rule: %w", err)
}
delete(r.rules, ruleID)
}
r.updateState()
return nil
}
func applyPort(flag string, port *firewall.Port) []string {
if port == nil {
return nil
}
if port.IsRange && len(port.Values) == 2 {
return []string{flag, fmt.Sprintf("%d:%d", port.Values[0], port.Values[1])}
}
if len(port.Values) > 1 {View on GitHub (pinned to 93e97f4bf1)