hashicorp/nomad · error

no network_interface given and failed to determine interface

Error message

no network_interface given and failed to determine interface attached to default route

What it means

findInterface was called without a configured network_interface, so it tried to discover the interface attached to the default route. The route lookup returned an empty interface name without an error, so no device can be selected and the network fingerprinter errors.

Source

Thrown at client/fingerprint/network.go:345

	return nwResources, nil
}

// Returns the interface with the name passed by user. If the name is blank, we
// use the interface attached to the default route.
func (f *NetworkFingerprint) findInterface(deviceName string) (*net.Interface, error) {
	// If we aren't given a device, look it up by using the interface with the default route
	if deviceName == "" {
		ri, err := sockaddr.NewRouteInfo()
		if err != nil {
			return nil, err
		}

		defaultIfName, err := ri.GetDefaultInterfaceName()
		if err != nil {
			return nil, err
		}
		if defaultIfName == "" {
			return nil, fmt.Errorf("no network_interface given and failed to determine interface attached to default route")
		}
		deviceName = defaultIfName
	}

	return f.interfaceDetector.InterfaceByName(deviceName)
}

// Define a type for the comparison function
type LessFunc[T any] func(a, b T) bool

// Generic sort function
func sortResources[T any](res []T, less LessFunc[T]) {
	sort.Slice(res, func(i, j int) bool {
		return less(res[i], res[j])
	})
}

// Less functions for each resource type and address family

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Set an explicit network_interface in the client config instead of relying on default-route detection.
  2. Add a default route to the host/network namespace so GetDefaultInterfaceName can resolve one.
  3. Verify routing with 'ip route show default' and fix network configuration.
  4. Disable the network fingerprinter if no network fingerprint is required.

Example fix

// before
# network_interface not set, no default route on host
// after (client config hcl)
client {
  network_interface = "eth1"
}
Defensive patterns

Strategy: validation

Validate before calling

ifName := cfg.NetworkInterface
if ifName == "" {
	out, err := exec.Command("ip", "route", "show", "default").Output()
	if err != nil || len(strings.TrimSpace(string(out))) == 0 {
		return fmt.Errorf("no default route; set network_interface explicitly")
	}
}

Try / catch

if err := fp.Fingerprint(req); err != nil {
	if strings.Contains(err.Error(), "failed to determine interface attached to default route") {
		log.Print("host has no default route; configure network_interface explicitly")
		return nil
	}
	return err
}

Prevention

When it happens

Trigger: network_interface is empty in the client config AND ri.GetDefaultInterfaceName() returns "" without an error — the system cannot report a default-route interface.

Common situations: Hosts with no default route (isolated networks, netns without routes); minimal containers lacking route data; environments where the routing table is unavailable or empty.

Related errors


AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04). Data as JSON: /api/errors/e546bb173d949ffc. Report an issue: GitHub.