AdguardTeam/AdGuardHome · error

gateway ip %v in the ip range: %v-%v

Error message

gateway ip %v in the ip range: %v-%v

What it means

DHCP configuration validation rejects a gateway address that lies inside the dynamic lease range (RangeStart–RangeEnd). Assigning the gateway as a dynamic lease would break networking for clients.

Source

Thrown at internal/dhcpd/config.go:219

		return err
	}

	rangeEnd, err := ensureV4(c.RangeEnd, "address")
	if err != nil {
		// Don't wrap the error since it's informative enough as is and there is
		// an annotation deferred already.
		return err
	}

	c.ipRange, err = newIPRange(rangeStart.AsSlice(), rangeEnd.AsSlice())
	if err != nil {
		// Don't wrap the error since it's informative enough as is and there is
		// an annotation deferred already.
		return err
	}

	if c.ipRange.contains(gatewayIP.AsSlice()) {
		return fmt.Errorf(
			"gateway ip %v in the ip range: %v-%v",
			gatewayIP,
			c.RangeStart,
			c.RangeEnd,
		)
	}

	if !c.subnet.Contains(rangeStart) {
		return fmt.Errorf(
			"range start %v is outside network %v",
			c.RangeStart,
			c.subnet,
		)
	}

	if !c.subnet.Contains(rangeEnd) {
		return fmt.Errorf(
			"range end %v is outside network %v",

View on GitHub (pinned to b41aefbe51)

Solutions

  1. Move gateway_ip outside range_start..range_end (e.g. use range 192.168.1.10–254 with gateway .1)
  2. Or shrink the range so it no longer contains the gateway
  3. Re-apply DHCP config

Example fix

# before
range_start: 192.168.1.1
range_end: 192.168.1.100
gateway_ip: 192.168.1.1
# after
range_start: 192.168.1.10
range_end: 192.168.1.100
gateway_ip: 192.168.1.1
Defensive patterns

Strategy: validation

Validate before calling

// reject gateway inside range before applying
if ipInRange(gateway, rangeStart, rangeEnd) { return errors.New("gateway must be outside lease range") }

Prevention

When it happens

Trigger: Setting Conf4 gateway_ip to an address between range_start and range_end inclusive, then calling Create/v4Create (which validates).

Common situations: Copy-pasted ranges like 192.168.1.1–192.168.1.100 with default gateway .1; UI misconfigurations where the gateway was set after the range.

Related errors


AI-assisted analysis of AdguardTeam/AdGuardHome@b41aefbe51 (2026-08-27). Data as JSON: /api/errors/f37516c9dadbd7fe. Report an issue: GitHub.