AdguardTeam/AdGuardHome · error
cannot get network interfaces: %w
Error message
cannot get network interfaces: %w
What it means
While expanding wildcard DNS bind addresses (0.0.0.0/::) into concrete addresses for the status API, enumeration of network interfaces via aghnet.GetValidNetInterfacesForWeb failed. The wrapped error comes from net.Interfaces.
Source
Thrown at internal/home/control.go:57
// dst. It also adds the IP addresses of all network interfaces if src contains
// an unspecified IP address.
func appendDNSAddrsWithIfaces(dst []string, src []netip.Addr) (res []string, err error) {
ifacesAdded := false
for _, h := range src {
if !h.IsUnspecified() {
dst = appendDNSAddrs(dst, h)
continue
} else if ifacesAdded {
continue
}
// Add addresses of all network interfaces for addresses like
// "0.0.0.0" and "::".
var ifaces []*aghnet.NetInterface
ifaces, err = aghnet.GetValidNetInterfacesForWeb()
if err != nil {
return nil, fmt.Errorf("cannot get network interfaces: %w", err)
}
for _, iface := range ifaces {
dst = appendDNSAddrs(dst, iface.Addresses...)
}
ifacesAdded = true
}
return dst, nil
}
// collectDNSAddresses returns the list of DNS addresses the server is listening
// on, including the addresses on all interfaces in cases of unspecified IPs.
// extTLSConf must not be nil.
func collectDNSAddresses(extTLSConf *aghtls.ExtendedTLSConfig) (addrs []string, err error) {
if hosts := config.DNS.BindHosts; len(hosts) == 0 {
addrs = appendDNSAddrs(addrs, netutil.IPv4Localhost())View on GitHub (pinned to b41aefbe51)
Solutions
- Check the wrapped error for the syscall-level cause
- In containers, ensure adequate network namespace visibility (avoid --network none with wildcard binds, run with normal netns)
- Restart the service if the failure was transient interface churn
- Bind DNS to explicit IPs instead of 0.0.0.0 to bypass interface enumeration
Example fix
# before dns: bind_hosts: [0.0.0.0] # after dns: bind_hosts: [192.168.1.10]
Defensive patterns
Strategy: fallback
Try / catch
// Catch and degrade: report status without expanded addresses
if err != nil { addrs = []string{"unavailable"} } Prevention
- Prefer explicit bind IPs over 0.0.0.0 in containers
- Ensure containers run with a normal network namespace
When it happens
Trigger: GET /control/status when DNS bind hosts contain wildcard addresses and the OS fails to enumerate interfaces (net.Interfaces error).
Common situations: Containerized environments with restricted /sys or netlink, heavily chrooted processes, interfaces disappearing mid-enumeration, OS-level networking stack issues.
Related errors
- collecting dns addresses: %w
- creating dns server: %w
- starting dnssvc: %w
- parsing json time: %w
- json time is nil
AI-assisted analysis of AdguardTeam/AdGuardHome@b41aefbe51 (2026-08-27).
Data as JSON: /api/errors/0f9f4347555c3523.
Report an issue: GitHub.