XTLS/Xray-core · warning

physical default route not found

Error message

physical default route not found

What it means

Inside findDefaultInterface, per-family routes are scanned and candidate interfaces filtered: they must be UP and must not be loopback. If no route's interface passes these filters, this error is returned for that family (it only becomes fatal when the other family also fails, producing error 770). Routes on the TUN are excluded upstream via tunIndex.

Source

Thrown at proxy/tun/tun_linux.go:402

		iface, err := net.InterfaceByIndex(route.LinkIndex)
		if err != nil {
			continue
		}

		if iface.Flags&net.FlagUp == 0 ||
			iface.Flags&net.FlagLoopback != 0 {
			continue
		}

		if selected == nil || route.Priority < selectedMetric {
			selected = iface
			selectedMetric = route.Priority
		}
	}

	if selected == nil {
		return nil, errors.New("physical default route not found")
	}

	return selected, nil
}

View on GitHub (pinned to 7d214f8b09)

Solutions

  1. Bring the physical interface up and confirm connectivity (`ip link set eth0 up`, check carrier)
  2. Set the fixed outbound interface in config to bypass auto-detection
  3. Ensure no other VPN owns 0.0.0.0/0 before starting Xray's tun mode
Defensive patterns

Strategy: validation

Validate before calling

for _, f := range []int{netlink.FAMILY_V4, netlink.FAMILY_V6} {
	routes, err := netlink.RouteList(nil, f)
	if err != nil { continue }
	for _, r := range routes {
		if r.Dst != nil || r.LinkIndex == tunIndex { continue }
		iface, err := net.InterfaceByIndex(r.LinkIndex)
		if err != nil { continue }
		if iface.Flags&net.FlagUp != 0 && iface.Flags&net.FlagLoopback == 0 {
			goto ok // at least one usable interface
		}
	}
}
log.Fatal("no UP non-loopback default-route interface")
ok:

Prevention

When it happens

Trigger: Default route exists but its interface is DOWN (cable pulled, wifi off); the only default route goes via the TUN itself (excluded); interface is loopback; netlink.RouteList succeeds but returns nothing usable.

Common situations: Laptop with wifi toggled off while config auto-detects; nested VPN where a prior tunnel owns the default route; NM-managed interface temporarily down during startup.

Related errors


AI-assisted analysis of XTLS/Xray-core@7d214f8b09 (2026-08-15). Data as JSON: /api/errors/640f838afc971824. Report an issue: GitHub.