{"record":{"id":"f37516c9dadbd7fe","repo":"AdguardTeam/AdGuardHome","slug":"gateway-ip-v-in-the-ip-range-v-v","errorCode":null,"errorMessage":"gateway ip %v in the ip range: %v-%v","messagePattern":"gateway ip (.+?) in the ip range: (.+?)-(.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/dhcpd/config.go","lineNumber":219,"sourceCode":"\t\treturn err\n\t}\n\n\trangeEnd, err := ensureV4(c.RangeEnd, \"address\")\n\tif err != nil {\n\t\t// Don't wrap the error since it's informative enough as is and there is\n\t\t// an annotation deferred already.\n\t\treturn err\n\t}\n\n\tc.ipRange, err = newIPRange(rangeStart.AsSlice(), rangeEnd.AsSlice())\n\tif err != nil {\n\t\t// Don't wrap the error since it's informative enough as is and there is\n\t\t// an annotation deferred already.\n\t\treturn err\n\t}\n\n\tif c.ipRange.contains(gatewayIP.AsSlice()) {\n\t\treturn fmt.Errorf(\n\t\t\t\"gateway ip %v in the ip range: %v-%v\",\n\t\t\tgatewayIP,\n\t\t\tc.RangeStart,\n\t\t\tc.RangeEnd,\n\t\t)\n\t}\n\n\tif !c.subnet.Contains(rangeStart) {\n\t\treturn fmt.Errorf(\n\t\t\t\"range start %v is outside network %v\",\n\t\t\tc.RangeStart,\n\t\t\tc.subnet,\n\t\t)\n\t}\n\n\tif !c.subnet.Contains(rangeEnd) {\n\t\treturn fmt.Errorf(\n\t\t\t\"range end %v is outside network %v\",","sourceCodeStart":201,"sourceCodeEnd":237,"githubUrl":"https://github.com/AdguardTeam/AdGuardHome/blob/b41aefbe51c8dde65e2c50f093996afa0502edf9/internal/dhcpd/config.go#L201-L237","documentation":"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.","triggerScenarios":"Setting Conf4 gateway_ip to an address between range_start and range_end inclusive, then calling Create/v4Create (which validates).","commonSituations":"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.","solutions":["Move gateway_ip outside range_start..range_end (e.g. use range 192.168.1.10–254 with gateway .1)","Or shrink the range so it no longer contains the gateway","Re-apply DHCP config"],"exampleFix":"# before\nrange_start: 192.168.1.1\nrange_end: 192.168.1.100\ngateway_ip: 192.168.1.1\n# after\nrange_start: 192.168.1.10\nrange_end: 192.168.1.100\ngateway_ip: 192.168.1.1","handlingStrategy":"validation","validationCode":"// reject gateway inside range before applying\nif ipInRange(gateway, rangeStart, rangeEnd) { return errors.New(\"gateway must be outside lease range\") }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Choose gateway at a low address (.1) and start the range above it","Validate in config UI before submit"],"tags":["dhcp","gateway","ip-range","validation"],"backgroundTag":"dhcp-gateway-in-lease-range","analyzedSha":"b41aefbe51c8dde65e2c50f093996afa0502edf9","analyzedAt":"2026-08-27T04:57:55.097Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}