TechnitiumSoftware / DnsServer

Technitium DNS Server
https://technitium.com/dns/
GNU General Public License v3.0
4.47k stars 431 forks source link

DHCP Server failing to assign addresses. #864

Closed kistelek2 closed 9 months ago

kistelek2 commented 9 months ago

DHCP stopped working last night after Windows11 host updated and rebooted. DNS works fine. Backed update out. No change. Service starts but doesn't enable scope. Manually enabling scope adds correct interface address on gui but still doesn't serve address. Posted on Reddit.

C:\Windows\System32>netstat -ano | find ":67" TCP 127.0.0.1:6789 0.0.0.0:0 LISTENING 5108 UDP 0.0.0.0:6700 : 8396 UDP 0.0.0.0:6749 : 8396 UDP 0.0.0.0:6750 : 8396 UDP 0.0.0.0:6761 : 8396 UDP 0.0.0.0:6792 : 8396 UDP 192.168.1.254:67 : 5108

[2024-02-15 14:23:20 Local] Logging started.
[2024-02-15 14:23:20 Local] [192.168.1.252:61124] [admin] All log files were deleted.
[2024-02-15 14:23:38 Local] DHCP Server successfully unloaded scope: NewGrove
[2024-02-15 14:23:38 Local] Saving DNS Cache to disk...
[2024-02-15 14:23:40 Local] DNS Cache was saved to disk successfully.
[2024-02-15 14:23:40 Local] DNS Server (v12.0.1.0) was stopped successfully.
[2024-02-15 14:23:40 Local] DNS Server auth config file was saved: C:\Program Files (x86)\Technitium\DNS Server\config\auth.config
[2024-02-15 14:23:40 Local] Logging stopped.
[2024-02-15 14:23:41 Local] Logging started.
[2024-02-15 14:23:41 Local] DNS Server auth config file was loaded: C:\Program Files (x86)\Technitium\DNS Server\config\auth.config
[2024-02-15 14:23:41 Local] DNS Server config file was loaded: C:\Program Files (x86)\Technitium\DNS Server\config\dns.config
[2024-02-15 14:23:41 Local] DNS Server successfully loaded zone file: C:\Program Files (x86)\Technitium\DNS Server\config\zones\1.168.192.in-addr.arpa.zone
[2024-02-15 14:23:41 Local] DNS Server successfully loaded zone file: C:\Program Files (x86)\Technitium\DNS Server\config\zones\home.zone
[2024-02-15 14:23:41 Local] DNS Server successfully loaded zone file: C:\Program Files (x86)\Technitium\DNS Server\config\zones\kistelek.hom.zone
[2024-02-15 14:23:41 Local] DNS Server is loading allowed zone file: C:\Program Files (x86)\Technitium\DNS Server\config\allowed.config
[2024-02-15 14:23:41 Local] DNS Server is loading blocked zone file: C:\Program Files (x86)\Technitium\DNS Server\config\blocked.config
[2024-02-15 14:23:41 Local] Loading DNS Cache from disk...
[2024-02-15 14:23:42 Local] DNS Cache was loaded from disk successfully.
[2024-02-15 14:23:42 Local] [[::]:5380] [HTTP] Web Service was bound successfully.
[2024-02-15 14:23:42 Local] [0.0.0.0:53] [UDP] DNS Server was bound successfully.
[2024-02-15 14:23:42 Local] [0.0.0.0:538] [UDPPROXY] DNS Server was bound successfully.
[2024-02-15 14:23:42 Local] [0.0.0.0:53] [TCP] DNS Server was bound successfully.
[2024-02-15 14:23:42 Local] [0.0.0.0:538] [TCPPROXY] DNS Server was bound successfully.
[2024-02-15 14:23:42 Local] [[::]:53] [UDP] DNS Server was bound successfully.
[2024-02-15 14:23:42 Local] [[::]:538] [UDPPROXY] DNS Server was bound successfully.
[2024-02-15 14:23:42 Local] [[::]:53] [TCP] DNS Server was bound successfully.
[2024-02-15 14:23:42 Local] [[::]:538] [TCPPROXY] DNS Server was bound successfully.
[2024-02-15 14:23:42 Local] [[::]:80] [HTTP] DNS Server was bound successfully.
[2024-02-15 14:23:42 Local] DHCP Server successfully loaded scope: NewGrove
[2024-02-15 14:23:42 Local] DHCP Server successfully loaded scope file: C:\Program Files (x86)\Technitium\DNS Server\config\scopes\NewGrove.scope
[2024-02-15 14:23:42 Local] DNS Server (v12.0.1.0) was started successfully.
[2024-02-15 14:23:51 Local] DNS Server auth config file was saved: C:\Program Files (x86)\Technitium\DNS Server\config\auth.config
[2024-02-15 14:23:56 Local] [192.168.1.254:67] DHCP Server failed to activate scope: NewGrove
System.Net.Sockets.SocketException (10048): Only one usage of each socket address (protocol/network address/port) is normally permitted.
   at System.Net.Sockets.Socket.UpdateStatusAfterSocketErrorAndThrowException(SocketError error, Boolean disconnectOnFailure, String callerName)
   at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress)
   at System.Net.Sockets.Socket.Bind(EndPoint localEP)
   at DnsServerCore.Dhcp.DhcpServer.<>c__DisplayClass27_0.<BindUdpListener>b__0(IPAddress key) in Z:\Technitium\Projects\DnsServer\DnsServerCore\Dhcp\DhcpServer.cs:line 951
   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
   at DnsServerCore.Dhcp.DhcpServer.BindUdpListener(IPEndPoint dhcpEP) in Z:\Technitium\Projects\DnsServer\DnsServerCore\Dhcp\DhcpServer.cs:line 925
   at DnsServerCore.Dhcp.DhcpServer.ActivateScopeAsync(Scope scope, Boolean waitForInterface, Boolean throwException) in Z:\Technitium\Projects\DnsServer\DnsServerCore\Dhcp\DhcpServer.cs:line 1033
[2024-02-15 14:23:56 Local] System.Net.Sockets.SocketException (10048): Only one usage of each socket address (protocol/network address/port) is normally permitted.
   at System.Net.Sockets.Socket.UpdateStatusAfterSocketErrorAndThrowException(SocketError error, Boolean disconnectOnFailure, String callerName)
   at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress)
   at System.Net.Sockets.Socket.Bind(EndPoint localEP)
   at DnsServerCore.Dhcp.DhcpServer.<>c__DisplayClass27_0.<BindUdpListener>b__0(IPAddress key) in Z:\Technitium\Projects\DnsServer\DnsServerCore\Dhcp\DhcpServer.cs:line 951
   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
   at DnsServerCore.Dhcp.DhcpServer.BindUdpListener(IPEndPoint dhcpEP) in Z:\Technitium\Projects\DnsServer\DnsServerCore\Dhcp\DhcpServer.cs:line 925
   at DnsServerCore.Dhcp.DhcpServer.ActivateScopeAsync(Scope scope, Boolean waitForInterface, Boolean throwException) in Z:\Technitium\Projects\DnsServer\DnsServerCore\Dhcp\DhcpServer.cs:line 1033
   at DnsServerCore.Dhcp.DhcpServer.EnableScopeAsync(String name, Boolean throwException) in Z:\Technitium\Projects\DnsServer\DnsServerCore\Dhcp\DhcpServer.cs:line 1346
   at DnsServerCore.WebServiceDhcpApi.EnableDhcpScopeAsync(HttpContext context) in Z:\Technitium\Projects\DnsServer\DnsServerCore\WebServiceDhcpApi.cs:line 726
   at DnsServerCore.DnsWebService.WebServiceApiMiddleware(HttpContext context, RequestDelegate next) in Z:\Technitium\Projects\DnsServer\DnsServerCore\DnsWebService.cs:line 591
   at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddlewareImpl.<Invoke>g__Awaited|10_0(ExceptionHandlerMiddlewareImpl middleware, HttpContext context, Task task)
ShreyasZare commented 9 months ago

Thanks for the details. From the netstat output, it looks like 67xx ports belong to the DNS server's UDP socket pool. So the DNS server's process ID seems to be 8396.

UDP 192.168.1.254:67 : 5108

There seems to be another process with ID 5108 that is occupying UDP port 67. This looks like the reason why the DHCP scope is failing to activate.

I would suggest to run the netstat command again and the match the process ID with tasklist command and find out which process is actually using the UDP port 67.

kistelek2 commented 9 months ago

FIxed. Suffered from Idiot Operator error. Had 2 DHCP servers accidentally running on same box. Thanks.

ShreyasZare commented 9 months ago

Good to know you got it fixed.