netbirdio/netbird · error

set IPv4 interface MTU: %s

Error message

set IPv4 interface MTU: %s

What it means

Windows Create() sets NLMTU on the MIB_IPINTERFACE_ROW returned by the previous query and applies it via Set() (SetIpInterfaceEntry). Failure of that call is wrapped here and the device is closed. This is the IPv4 MTU apply; the later IPv6 MTU apply is deliberately soft (warn plus ClearIPv6), so only IPv4 MTU problems abort creation.

Source

Thrown at client/iface/device/device_windows.go:90

		t.filteredDevice,
		t.iceBind,
		device.NewLogger(wgLogLevel(), "[netbird] "),
	)

	luid := winipcfg.LUID(t.nativeTunDevice.LUID())

	nbiface, err := luid.IPInterface(windows.AF_INET)
	if err != nil {
		t.device.Close()
		return nil, fmt.Errorf("got error when getting ip interface %s", err)
	}

	nbiface.NLMTU = uint32(t.mtu)

	err = nbiface.Set()
	if err != nil {
		t.device.Close()
		return nil, fmt.Errorf("set IPv4 interface MTU: %s", err)
	}

	if t.address.HasIPv6() {
		nbiface6, err := luid.IPInterface(windows.AF_INET6)
		if err != nil {
			log.Warnf("failed to get IPv6 interface for MTU, continuing v4-only: %v", err)
			t.address.ClearIPv6()
		} else {
			nbiface6.NLMTU = uint32(t.mtu)
			if err := nbiface6.Set(); err != nil {
				log.Warnf("failed to set IPv6 interface MTU, continuing v4-only: %v", err)
				t.address.ClearIPv6()
			}
		}
	}
	err = t.assignAddr()
	if err != nil {
		t.device.Close()

View on GitHub (pinned to 93e97f4bf1)

Solutions

  1. Clamp the configured MTU into the 1280-65535 range (WireGuard minimum is 1280)
  2. Retry with the default MTU to confirm the value is the cause
  3. Update wintun/client if Set fails even with a valid MTU

Example fix

// before
nbiface.NLMTU = uint32(t.mtu)
err = nbiface.Set()

// after
mtu := int(t.mtu)
if mtu < 1280 {
    mtu = 1280
}
if mtu > 65535 {
    mtu = 65535
}
nbiface.NLMTU = uint32(mtu)
err = nbiface.Set()
Defensive patterns

Strategy: validation

Validate before calling

const (
    minWGMTU = 1280
    maxWGMTU = 65535
)
if mtu < minWGMTU || mtu > maxWGMTU {
    return fmt.Errorf("mtu %d out of range [%d, %d]", mtu, minWGMTU, maxWGMTU)
}

Try / catch

if err := nbiface.Set(); err != nil {
    if nbiface.NLMTU < 576 {
        // MTU below IPv4 minimum: clamp and retry Set once
    }
    return fmt.Errorf("set IPv4 interface MTU: %w", err)
}

Prevention

When it happens

Trigger: MTU outside the accepted IPv4 range (below ~576 or above 65535), the interface row in a transient/invalid state, or SetIpInterfaceEntry returning an API error.

Common situations: An MDM policy or management config pushing an invalid MTU, default MTU misconfiguration, driver state issues after adapter churn.

Related errors


AI-assisted analysis of netbirdio/netbird@93e97f4bf1 (2026-08-16). Data as JSON: /api/errors/3c093e31b3d444e2. Report an issue: GitHub.