TechnitiumSoftware/DnsServer · error · DhcpServerException

DHCP Server requires static IP address to work correctly but

Error message

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}

What it means

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.

Source

Thrown at DnsServerCore/Dhcp/Scope.cs:702

                IPInterfaceProperties ipInterface = nic.GetIPProperties();

                foreach (UnicastIPAddressInformation ip in ipInterface.UnicastAddresses)
                {
                    if (ip.Address.AddressFamily == AddressFamily.InterNetwork)
                    {
                        uint addressNumber = ip.Address.ConvertIpToNumber();

                        if ((addressNumber & subnetMaskNumber) == networkAddressNumber)
                        {
                            //found interface for this scope range

                            //check if interface has dynamic ipv4 address assigned via dhcp
                            if (OperatingSystem.IsWindows() || OperatingSystem.IsLinux())
                            {
                                foreach (IPAddress dhcpServerAddress in ipInterface.DhcpServerAddresses)
                                {
                                    if (dhcpServerAddress.AddressFamily == AddressFamily.InterNetwork)
                                        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());
                                }
                            }

                            _interfaceAddress = ip.Address;
                            _interfaceIndex = ipInterface.GetIPv4Properties().Index;
                            return true;
                        }
                    }
                }
            }

            if (OperatingSystem.IsWindows() || OperatingSystem.IsLinux())
            {
                //check if at least one interface has static ip address
                foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces())
                {
                    if (nic.OperationalStatus != OperationalStatus.Up)
                        continue;

View on GitHub (pinned to d0484b6c1e)

Solutions

  1. Set a static IPv4 on the matching interface and disable DHCP client on it.
  2. Stop/disable the OS DHCP client service (dhclient/NetworkManager DHCP) for that interface.
  3. Confirm DhcpServerAddresses is empty for the interface before enabling the scope.

Example fix

// before: eth0 obtains 192.168.1.50 from 192.168.1.1 (another DHCP server)
// after: assign static IP and release DHCP lease
//   ip addr del 192.168.1.50/24 dev eth0
//   ip addr add 192.168.1.10/24 dev eth0
//   dhclient -r eth0
Defensive patterns

Strategy: validation

Validate before calling

var props = NetworkInterface.GetAllNetworkInterfaces()
    .First(i => i.GetIPProperties().UnicastAddresses.Any(u => u.Address.Equals(scope.StartingAddress))).GetIPProperties();
if (props.DhcpServerAddresses.Any(a => a.AddressFamily == AddressFamily.InterNetwork))
    throw new InvalidOperationException("Interface still uses DHCP; set a static IPv4.");

Type guard

static bool InterfaceIsStatic(NetIPProperties p) => !p.DhcpServerAddresses.Any(a => a.AddressFamily == AddressFamily.InterNetwork);

Try / catch

try { scope.FindInterface(); }
catch (DhcpServerException ex) when (ex.Message.Contains("dynamic IP address"))
{ /* set static IP, release DHCP lease, retry */ }

Prevention

When it happens

Trigger: scope.FindInterface() finds a matching interface, then on Windows/Linux iterates ipInterface.DhcpServerAddresses and finds at least one IPv4 address, throwing DhcpServerException.

Common situations: 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.

Related errors


AI-assisted analysis of TechnitiumSoftware/DnsServer@d0484b6c1e (2026-08-13). Data as JSON: /api/errors/68ac1bfddfc8c655. Report an issue: GitHub.