AdguardTeam/AdGuardHome · error
neither dhcpv4 nor dhcpv6 srv is configured
Error message
neither dhcpv4 nor dhcpv6 srv is configured
What it means
Create refuses to start because DHCP is globally enabled but neither the DHCPv4 nor DHCPv6 block is enabled — i.e. conf.Enabled is true while both Conf4 and Conf6 are inactive (v4 lacks a valid RangeStart, v6 lacks RangeStart).
Source
Thrown at internal/dhcpd/dhcpd.go:140
dbFilePath: filepath.Join(conf.DataDir, dataFilename),
},
}
// TODO(e.burkov): Don't register handlers, see TODO on
// [aghhttp.RegisterFunc].
s.registerHandlers()
v4Enabled, v6Enabled, err := s.setServers(ctx, conf)
if err != nil {
// Don't wrap the error, because it's informative enough as is.
return nil, err
}
s.conf.Conf4 = conf.Conf4
s.conf.Conf6 = conf.Conf6
if s.conf.Enabled && !v4Enabled && !v6Enabled {
return nil, fmt.Errorf("neither dhcpv4 nor dhcpv6 srv is configured")
}
// Migrate leases db if needed.
err = migrateDB(conf)
if err != nil {
// Don't wrap the error since it's informative enough as is.
return nil, err
}
// Don't delay database loading until the DHCP server is started,
// because we need static leases functionality available beforehand.
err = s.dbLoad()
if err != nil {
return nil, fmt.Errorf("loading db: %w", err)
}
return s, nil
}View on GitHub (pinned to b41aefbe51)
Solutions
- Set a valid IPv4 range_start/range_end or a DHCPv6 range_start before enabling DHCP
- Or keep enabled=false until a server block is configured
- Validate config in the caller before invoking Create
Example fix
// before
cfg.Enabled = true // no ranges set
// after
cfg.Enabled = true
cfg.Conf4.RangeStart = netip.MustParseAddr("192.168.1.10")
cfg.Conf4.RangeEnd = netip.MustParseAddr("192.168.1.254") Defensive patterns
Strategy: validation
Validate before calling
// before Create
v4ok := conf.Conf4.RangeStart.IsValid()
v6ok := len(conf.Conf6.RangeStart) != 0
if conf.Enabled && !v4ok && !v6ok { return errors.New("configure a v4 or v6 range first") } Prevention
- Always set a range before flipping enabled=true
- Validate config payloads in API handlers
When it happens
Trigger: Calling dhcpd.Create with Enabled=true, Conf4.RangeStart invalid/zero and Conf6.RangeStart empty — e.g. via the API with enabled=true but empty range settings.
Common situations: Enabling DHCP in the UI before filling in a range; API scripts setting enabled=true with partial config; defaults after upgrading where ranges are unset.
Related errors
- %v is not an IPv4 %s
- networksetup failed to set dns servers: %w
- found no dns servers in %s
- writing conf: %w
- invalid pattern %q: %w
AI-assisted analysis of AdguardTeam/AdGuardHome@b41aefbe51 (2026-08-27).
Data as JSON: /api/errors/8fdcc5baaac9926a.
Report an issue: GitHub.