v2rayA/v2rayA · warning
default interfaces not found
Error message
default interfaces not found
What it means
NoDefaultInterface is a sentinel error returned by GetDefaultInterfaceName (Linux only). It parses /proc/net/route for routes whose destination is 00000000 (the default route); if none are found the resulting interface list is empty and the sentinel is returned.
Source
Thrown at service/common/netTools/interface.go:9
package netTools
import (
"fmt"
"os/exec"
"strings"
)
var NoDefaultInterface = fmt.Errorf("default interfaces not found")
// only for linux
func GetDefaultInterfaceName() ([]string, error) {
b, err := exec.Command("sh", "-c", "awk '$2 == 00000000 { print $1 }' /proc/net/route").Output()
if err != nil {
return nil, err
}
ifnames := strings.Split(strings.TrimSpace(string(b)), "\n")
if len(ifnames) == 1 && ifnames[0] == "" {
return nil, NoDefaultInterface
}
return ifnames, nil
}
View on GitHub (pinned to 71e5442fc5)
Solutions
- Bring up the network interface and ensure a default route exists (dhclient / ip route add default via <gw>)
- Wait/retry until the network is up before calling (common at boot in containers)
- Add a default route manually if static networking is intended
- Verify with `awk '$2 == 00000000 {print $1}' /proc/net/route` locally
Example fix
// before (docker run) docker run --network none myimage // after docker run --network bridge myimage
Defensive patterns
Strategy: retry
Validate before calling
b, _ := os.ReadFile("/proc/net/route")
if !strings.Contains(string(b), "00000000") {
return fmt.Errorf("no default route yet; wait for network")
} Type guard
func hasDefaultRoute() bool {
b, err := os.ReadFile("/proc/net/route")
return err == nil && strings.Contains(string(b), "00000000")
} Try / catch
ifnames, err := netTools.GetDefaultInterfaceName()
if errors.Is(err, netTools.NoDefaultInterface) {
// wait/retry until network is up
time.Sleep(2 * time.Second)
return retry()
} Prevention
- Retry with backoff at boot before network is ready
- Ensure the container has a network mode providing a gateway
- Check /proc/net/route manually when debugging
When it happens
Trigger: Calling GetDefaultInterfaceName on a Linux system with no default route in /proc/net/route.
Common situations: Container or VM without a default gateway; machine with only link-local networking; interface down or DHCP not yet completed at startup.
Related errors
- target not specified
- failed to create anytls stream
- failed to write destination to anytls stream
- anytls connection ends
- target not specified
AI-assisted analysis of v2rayA/v2rayA@71e5442fc5 (2026-09-05).
Data as JSON: /api/errors/e62e122266adb655.
Report an issue: GitHub.