diff --git a/DnsServerCore/Dhcp/DhcpServer.cs b/DnsServerCore/Dhcp/DhcpServer.cs index 60e4215a..ee666b8b 100644 --- a/DnsServerCore/Dhcp/DhcpServer.cs +++ b/DnsServerCore/Dhcp/DhcpServer.cs @@ -795,10 +795,6 @@ namespace DnsServerCore.Dhcp try { - //find this dns server address in case the network config has changed - if (scope.UseThisDnsServer) - scope.FindThisDnsServerAddress(); - //find scope interface for binding socket if (waitForInterface) { @@ -821,6 +817,10 @@ namespace DnsServerCore.Dhcp 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(); + IPAddress interfaceAddress = scope.InterfaceAddress; dhcpEP = new IPEndPoint(interfaceAddress, 67); diff --git a/DnsServerCore/Dhcp/Scope.cs b/DnsServerCore/Dhcp/Scope.cs index 179d62f5..fe013229 100644 --- a/DnsServerCore/Dhcp/Scope.cs +++ b/DnsServerCore/Dhcp/Scope.cs @@ -448,7 +448,7 @@ namespace DnsServerCore.Dhcp { NetworkInterface[] networkInterfaces = NetworkInterface.GetAllNetworkInterfaces(); - //find interface in current scope range + //find interface in current scope network range uint networkAddressNumber = _networkAddress.ConvertIpToNumber(); uint subnetMaskNumber = _subnetMask.ConvertIpToNumber();