TechnitiumSoftware/DnsServer · error · ArgumentException
Exclusion ending address must be greater than or equal to st
Error message
Exclusion ending address must be greater than or equal to starting address.
What it means
Exclusion constructor validates that the ending address is not numerically before the starting address (using ConvertIpToNumber). An exclusion is an address range removed from a DHCP scope, so it must be a valid ordered range.
Source
Thrown at DnsServerCore/Dhcp/Exclusion.cs:40
using TechnitiumLibrary.Net;
namespace DnsServerCore.Dhcp
{
public class Exclusion
{
#region variables
readonly IPAddress _startingAddress;
readonly IPAddress _endingAddress;
#endregion
#region constructor
public Exclusion(IPAddress startingAddress, IPAddress endingAddress)
{
if (startingAddress.ConvertIpToNumber() > endingAddress.ConvertIpToNumber())
throw new ArgumentException("Exclusion ending address must be greater than or equal to starting address.");
_startingAddress = startingAddress;
_endingAddress = endingAddress;
}
#endregion
#region properties
public IPAddress StartingAddress
{ get { return _startingAddress; } }
public IPAddress EndingAddress
{ get { return _endingAddress; } }
#endregion
}
}View on GitHub (pinned to d0484b6c1e)
Solutions
- Swap the two addresses so starting <= ending (numerically).
- Validate/sort the pair before constructing: pass (min, max).
Example fix
// before
var ex = new Exclusion(Parse('192.168.1.200'), Parse('192.168.1.100'));
// after
var (lo, hi) = (Parse('192.168.1.100'), Parse('192.168.1.200'));
var ex = new Exclusion(lo, hi); Defensive patterns
Strategy: validation
Validate before calling
if (startingAddress.ConvertIpToNumber() > endingAddress.ConvertIpToNumber())
(startingAddress, endingAddress) = (endingAddress, startingAddress); Type guard
static bool ExclusionOrdered(IPAddress start, IPAddress end) => start.ConvertIpToNumber() <= end.ConvertIpToNumber();
Try / catch
try { new Exclusion(start, end); }
catch (ArgumentException ex) when (ex.Message.Contains("greater than or equal to starting"))
{ /* swap start/end, retry */ } Prevention
- Normalize (min, max) before constructing an Exclusion.
- Sort range endpoints at the UI/config boundary.
- Unit-test exclusion parsing with reversed inputs.
When it happens
Trigger: new Exclusion(startingAddress, endingAddress) with startingAddress.ConvertIpToNumber() > endingAddress.ConvertIpToNumber().
Common situations: UI form fields entered in the wrong order. Copy-paste of gateway/high-address into the 'from' field. IPv4 ordering assumption error.
Related errors
- Exclusion starting address must be in scope range.
- Exclusion ending address must be in scope range.
- Address family not supported.
- The address must be an IPv4 address: {ip}
- The address must be an IPv4 address: {value}
AI-assisted analysis of TechnitiumSoftware/DnsServer@d0484b6c1e (2026-08-13).
Data as JSON: /api/errors/9e55a0e67662a35d.
Report an issue: GitHub.