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 no network interface was found to have any static IP address configured.

What it means

Thrown from the waitForInterface retry loop in DhcpServer scope activation. The server retried finding a network interface for ~30 seconds (30 x 1s) and scope.InterfaceAddress was still null, meaning no interface with a matching static IP for this scope's range was found.

Source

Thrown at DnsServerCore/Dhcp/DhcpServer.cs:1102

            try
            {
                //find scope interface for binding socket
                if (waitForInterface)
                {
                    //retry for 30 seconds for interface to come up
                    int tries = 0;
                    while (true)
                    {
                        if (scope.FindInterface())
                        {
                            if (!scope.InterfaceAddress.Equals(IPAddress.Any))
                                break; //break only when specific interface address is found
                        }

                        if (++tries >= 30)
                        {
                            if (scope.InterfaceAddress == null)
                                throw new DhcpServerException("DHCP Server requires static IP address to work correctly but no network interface was found to have any static IP address configured.");

                            break; //use the available ANY interface address
                        }

                        await Task.Delay(1000);
                    }
                }
                else
                {
                    if (!scope.FindInterface())
                        throw new DhcpServerException("DHCP Server requires static IP address to work correctly but no network interface was found to have any static IP address configured.");
                }

                //find this dns server address in case the network config has changed
                if (scope.UseThisDnsServer)
                    scope.FindThisDnsServerAddress();

                dhcpEP = new IPEndPoint(scope.InterfaceAddress, 67);

View on GitHub (pinned to d0484b6c1e)

Solutions

  1. Assign a static IPv4 address on the correct subnet to a host interface, then restart the DHCP server.
  2. Verify the scope's starting/ending address and subnet mask match an attached interface's network.
  3. Increase readiness of the interface (start the service after networking is up) or pass waitForInterface=false during manual scope load.
  4. If running in a container, attach a host network/bridge with a static IP.

Example fix

// before: interface is DHCP-assigned, scope waits 30s then throws
// after: set static IP on eth0 in the scope subnet
//   ip addr add 192.168.1.10/24 dev eth0
// then start the service
Defensive patterns

Strategy: retry

Validate before calling

if (!scope.FindInterface() || scope.InterfaceAddress == null)
    throw new InvalidOperationException("No static IPv4 interface on subnet " + scope.StartingAddress + "/" + scope.SubnetMask);

Type guard

static bool ScopeHasInterface(Scope s) => s.FindInterface() && s.InterfaceAddress != null && !s.InterfaceAddress.Equals(IPAddress.Any);

Try / catch

try { await _dhcpServer.ActivateScopeAsync(scope, waitForInterface: true); }
catch (DhcpServerException ex) when (ex.Message.Contains("no network interface was found"))
{ /* configure static IP, then re-add scope */ }

Prevention

When it happens

Trigger: LoadScopeAsync/ActivateScopeAsync with waitForInterface=true. After `++tries >= 30` the loop exits and `scope.InterfaceAddress == null`, so no usable IPv4 interface exists for the scope's network.

Common situations: Host has no static IPv4 address on the scope subnet (DHCP-assigned or unconfigured NIC). Interface came up too slowly (>30s). Subnet mask / gateway mismatch so FindInterface never matches. Container/VM without a bridged interface.

Related errors


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