netbirdio/netbird · error

remove prerouting jump rule

Error message

remove prerouting jump rule: %w

What it means

During cleanupNoTrackChain teardown, deleting the PREROUTING jump rule into the NetBird raw chain failed. With this jump still present, inbound loopback packets remain diverted to the NetBird chain even after the manager exits, so cleanup aborts with this error instead of deleting a chain that is still referenced.

Solutions

  1. Remove manually with 'iptables -t raw -D PREROUTING -j <chain>'
  2. Restart-stop cycle the daemon to retry cleanup
  3. Fix underlying iptables availability issues
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at client/firewall/iptables/manager_linux.go:638 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/a2291af4e5108a7b. Report an issue: GitHub.

Appendix: source

Thrown at client/firewall/iptables/manager_linux.go:638

	exists, err := m.ipv4Client.ChainExists(tableRaw, chainNameRaw)
	if err != nil {
		if !m.rawSupported {
			return nil
		}
		return fmt.Errorf("check chain exists: %w", err)
	}
	if !exists {
		return nil
	}

	jumpRule := []string{"-j", chainNameRaw}

	if err := m.ipv4Client.DeleteIfExists(tableRaw, chainOUTPUT, jumpRule...); err != nil {
		return fmt.Errorf("remove output jump rule: %w", err)
	}

	if err := m.ipv4Client.DeleteIfExists(tableRaw, chainPREROUTING, jumpRule...); err != nil {
		return fmt.Errorf("remove prerouting jump rule: %w", err)
	}

	if err := m.ipv4Client.ClearAndDeleteChain(tableRaw, chainNameRaw); err != nil {
		return fmt.Errorf("clear and delete chain: %w", err)
	}

	m.rawSupported = false
	return nil
}

func getConntrackEstablished() []string {
	return []string{"-m", "conntrack", "--ctstate", "RELATED,ESTABLISHED", "-j", "ACCEPT"}
}

View on GitHub (pinned to 93e97f4bf1)