{"record":{"id":"68ac1bfddfc8c655","repo":"TechnitiumSoftware/DnsServer","slug":"dhcp-server-requires-static-ip-address-to-work-cor-68ac1b","errorCode":null,"errorMessage":"DHCP Server requires static IP address to work correctly but the network interface was found to have a dynamic IP address [{ip.Address}] assigned by another DHCP server: {dhcpServerAddress}","messagePattern":"DHCP Server requires static IP address to work correctly but the network interface was found to have a dynamic IP address \\[(.+?)\\] assigned by another DHCP server: (.+?)","errorType":"exception","errorClass":"DhcpServerException","httpStatus":null,"severity":"error","filePath":"DnsServerCore/Dhcp/Scope.cs","lineNumber":702,"sourceCode":"                IPInterfaceProperties ipInterface = nic.GetIPProperties();\n\n                foreach (UnicastIPAddressInformation ip in ipInterface.UnicastAddresses)\n                {\n                    if (ip.Address.AddressFamily == AddressFamily.InterNetwork)\n                    {\n                        uint addressNumber = ip.Address.ConvertIpToNumber();\n\n                        if ((addressNumber & subnetMaskNumber) == networkAddressNumber)\n                        {\n                            //found interface for this scope range\n\n                            //check if interface has dynamic ipv4 address assigned via dhcp\n                            if (OperatingSystem.IsWindows() || OperatingSystem.IsLinux())\n                            {\n                                foreach (IPAddress dhcpServerAddress in ipInterface.DhcpServerAddresses)\n                                {\n                                    if (dhcpServerAddress.AddressFamily == AddressFamily.InterNetwork)\n                                        throw new DhcpServerException(\"DHCP Server requires static IP address to work correctly but the network interface was found to have a dynamic IP address [\" + ip.Address.ToString() + \"] assigned by another DHCP server: \" + dhcpServerAddress.ToString());\n                                }\n                            }\n\n                            _interfaceAddress = ip.Address;\n                            _interfaceIndex = ipInterface.GetIPv4Properties().Index;\n                            return true;\n                        }\n                    }\n                }\n            }\n\n            if (OperatingSystem.IsWindows() || OperatingSystem.IsLinux())\n            {\n                //check if at least one interface has static ip address\n                foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces())\n                {\n                    if (nic.OperationalStatus != OperationalStatus.Up)\n                        continue;","sourceCodeStart":684,"sourceCodeEnd":720,"githubUrl":"https://github.com/TechnitiumSoftware/DnsServer/blob/d0484b6c1e7439cdc53d67d81e9c876cda2ad756/DnsServerCore/Dhcp/Scope.cs#L684-L720","documentation":"FindInterface located an interface on the scope subnet but discovered that interface still gets its IPv4 from another DHCP server (DhcpServerAddresses contains an IPv4). The DHCP server refuses to run on a dynamically-addressed interface to avoid conflicts.","triggerScenarios":"scope.FindInterface() finds a matching interface, then on Windows/Linux iterates ipInterface.DhcpServerAddresses and finds at least one IPv4 address, throwing DhcpServerException.","commonSituations":"Host NIC left in DHCP mode. Cloud/VM image that obtains IP via DHCP. NetworkManager/dhclient still active. Running DHCP server on the same interface that is itself a DHCP client.","solutions":["Set a static IPv4 on the matching interface and disable DHCP client on it.","Stop/disable the OS DHCP client service (dhclient/NetworkManager DHCP) for that interface.","Confirm DhcpServerAddresses is empty for the interface before enabling the scope."],"exampleFix":"// before: eth0 obtains 192.168.1.50 from 192.168.1.1 (another DHCP server)\n// after: assign static IP and release DHCP lease\n//   ip addr del 192.168.1.50/24 dev eth0\n//   ip addr add 192.168.1.10/24 dev eth0\n//   dhclient -r eth0","handlingStrategy":"validation","validationCode":"var props = NetworkInterface.GetAllNetworkInterfaces()\n    .First(i => i.GetIPProperties().UnicastAddresses.Any(u => u.Address.Equals(scope.StartingAddress))).GetIPProperties();\nif (props.DhcpServerAddresses.Any(a => a.AddressFamily == AddressFamily.InterNetwork))\n    throw new InvalidOperationException(\"Interface still uses DHCP; set a static IPv4.\");","typeGuard":"static bool InterfaceIsStatic(NetIPProperties p) => !p.DhcpServerAddresses.Any(a => a.AddressFamily == AddressFamily.InterNetwork);","tryCatchPattern":"try { scope.FindInterface(); }\ncatch (DhcpServerException ex) when (ex.Message.Contains(\"dynamic IP address\"))\n{ /* set static IP, release DHCP lease, retry */ }","preventionTips":["Disable the OS DHCP client on the server interface.","Assign static IPs before enabling scopes.","Verify DhcpServerAddresses is empty for the interface."],"tags":["dhcp","networking","ipv4","static-ip","configuration"],"backgroundTag":null,"analyzedSha":"d0484b6c1e7439cdc53d67d81e9c876cda2ad756","analyzedAt":"2026-08-13T22:57:35.508Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}