{"record":{"id":"640f838afc971824","repo":"XTLS/Xray-core","slug":"physical-default-route-not-found","errorCode":null,"errorMessage":"physical default route not found","messagePattern":"physical default route not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"proxy/tun/tun_linux.go","lineNumber":402,"sourceCode":"\n\t\tiface, err := net.InterfaceByIndex(route.LinkIndex)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tif iface.Flags&net.FlagUp == 0 ||\n\t\t\tiface.Flags&net.FlagLoopback != 0 {\n\t\t\tcontinue\n\t\t}\n\n\t\tif selected == nil || route.Priority < selectedMetric {\n\t\t\tselected = iface\n\t\t\tselectedMetric = route.Priority\n\t\t}\n\t}\n\n\tif selected == nil {\n\t\treturn nil, errors.New(\"physical default route not found\")\n\t}\n\n\treturn selected, nil\n}\n","sourceCodeStart":384,"sourceCodeEnd":407,"githubUrl":"https://github.com/XTLS/Xray-core/blob/7d214f8b094f75322fa3990f8aadad1c912f24f5/proxy/tun/tun_linux.go#L384-L407","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Bring the physical interface up and confirm connectivity (`ip link set eth0 up`, check carrier)","Set the fixed outbound interface in config to bypass auto-detection","Ensure no other VPN owns 0.0.0.0/0 before starting Xray's tun mode"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"for _, f := range []int{netlink.FAMILY_V4, netlink.FAMILY_V6} {\n\troutes, err := netlink.RouteList(nil, f)\n\tif err != nil { continue }\n\tfor _, r := range routes {\n\t\tif r.Dst != nil || r.LinkIndex == tunIndex { continue }\n\t\tiface, err := net.InterfaceByIndex(r.LinkIndex)\n\t\tif err != nil { continue }\n\t\tif iface.Flags&net.FlagUp != 0 && iface.Flags&net.FlagLoopback == 0 {\n\t\t\tgoto ok // at least one usable interface\n\t\t}\n\t}\n}\nlog.Fatal(\"no UP non-loopback default-route interface\")\nok:","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Bring physical links up before starting xray","Set a fixed outbound interface for deterministic behavior","Avoid nested VPNs owning the default route"],"tags":["tun","linux","routing","interface","auto-detect"],"backgroundTag":null,"analyzedSha":"7d214f8b094f75322fa3990f8aadad1c912f24f5","analyzedAt":"2026-08-15T14:26:24.325Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}