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

  1. Bring up the network interface and ensure a default route exists (dhclient / ip route add default via <gw>)
  2. Wait/retry until the network is up before calling (common at boot in containers)
  3. Add a default route manually if static networking is intended
  4. 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

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


AI-assisted analysis of v2rayA/v2rayA@71e5442fc5 (2026-09-05). Data as JSON: /api/errors/e62e122266adb655. Report an issue: GitHub.