TechnitiumSoftware / DnsServer

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

Windows' Hotspot doesn't work after installing .NET 5 desktop runtime #258

Closed MarcoPellizzoni closed 3 years ago

MarcoPellizzoni commented 3 years ago

Hi, I need to use the server with the hotspot of my laptop enabled.

The problem is the following: 1) I install .NET 5, I reboot the system, I activate the hotspot and try to connect my smartphone. The smartphone receives an IP correctly, but says "internet is not available". 2) I uninstall .NET 5, I reboot the system, everything works fine.

I tried different versions of .NET 5 and nothing changes. What is the problem with .NET 5? What can I do to use the DNS server anyway?

ShreyasZare commented 3 years ago

Thanks for the post. This issue is with how the Windows 10 hotspot works and not related to .NET 5.

For it to work with your local DNS server, its required that you specify your laptop's LAN IP address as the DNS Server in the network adapter instead of using 127.0.0.1.

Once you do that, try to reconnect your phone to the hotspot and it should work.

MarcoPellizzoni commented 3 years ago

sorry could you please be more specify? What network adapter are you referring to? There are three adapters in total: The main adapter, the one that windows creates virtually for the hotspot and the one in my phone. Nevertheless I think you misunderstood the issue. Irrespective of the presence of Technitium DNS server in my laptop and without change any configuration in the adapters, whenever installing .NET 5 the phone cannot connect to internet anymore, whenever uninstalling NET 5, the phone connects properly.

ShreyasZare commented 3 years ago

sorry could you please be more specify? What network adapter are you referring to? There are three adapters in total: The main adapter, the one that windows creates virtually for the hotspot and the one in my phone.

I was referring to the main adapter on your Windows 10 machine which is providing the internet access.

Nevertheless I think you misunderstood the issue. Irrespective of the presence of Technitium DNS server in my laptop and without change any configuration in the adapters, whenever installing .NET 5 the phone cannot connect to internet anymore, whenever uninstalling NET 5, the phone connects properly.

I am not sure about this since its working well here with .NET 5. I am able to use the hotspot with no issues with my phone.

MarcoPellizzoni commented 3 years ago

Maybe net 5 sets something on windows registry or sets some rule in windows firewall? I don't know... And there is an other mysterious thing: I discover that going to the network settings of the phone and changing the DNS ip into an IP that do not belong to the subnet mask of my network, it works! But this way, seems to have trouble connecting to my webpage, even if I insert the IP of my laptop as the URL.

ShreyasZare commented 3 years ago

Maybe net 5 sets something on windows registry or sets some rule in windows firewall? I don't know...

I don't really think its related to .NET 5 since it would have created a huge issue for everyone and would have been discovered by now.

And there is an other mysterious thing: I discover that going to the network settings of the phone and changing the DNS ip into an IP that do not belong to the subnet mask of my network, it works! But this way, seems to have trouble connecting to my webpage, even if I insert the IP of my laptop as the URL.

Running DNS server on the same laptop with hotspot is tricky thing since the hotspot is going to capture the UDP port 53 on 0.0.0.0 which will make the DNS server fail to use that port. So, you need to bind the DNS server to the IP address that is available on your LAN and then configure that same IP as the DNS server in the network adapter settings. Only then it works with the devices connecting to the hotspot.

josh0036 commented 3 years ago

Hi, I need to use the server with the hotspot of my laptop enabled.

The problem is the following:

  1. I install .NET 5, I reboot the system, I activate the hotspot and try to connect my smartphone. The smartphone receives an IP correctly, but says "internet is not available".
  2. I uninstall .NET 5, I reboot the system, everything works fine.

I tried different versions of .NET 5 and nothing changes. What is the problem with .NET 5? What can I do to use the DNS server anyway?

I experience something similar to this one.

Try to install .net 5.0.5 in a normal way and include asp.net core if necessary. I hope you're not using other disk drives as a system disk (drive: D for example it creates an error sometimes).

Are you using windows 10 pro?

MarcoPellizzoni commented 3 years ago

I installed the version that includes asp.net I have only one partition I have windows 10 home

ShreyasZare commented 3 years ago

Thanks both of you for the feedback.

Does this issue occurs only when DNS server is running? Can you try to enable the hotspot after stopping the DNS server using Windows Services Console or using the DNS server system tray app? This is since the hotspot also starts its on DNS proxy on port 53 and there could be a conflict there.

Another thing, try connecting to your hotspot with manual IP configuration on your phone. Find out the IP address range first by connecting directly and then use an IP address in that range with DNS servers set to Google (8.8.8.8) or Cloudflare (1.1.1.1). See if internet works on your phone this way. If its working then the issue is not with the hotspot but just the DNS part which can be fixed with correct configuration.

MarcoPellizzoni commented 3 years ago

Hi, sorry for the late response.

Today I reinstalled the .NET 5 desktop runtime downloading it from the microsoft website. I rebooted the system and there were no malfunctioning in the hotspot functionality. So I tried to install the DNS server then and rebooted. And that is the precise moment in which the hotspot doesnt' work. Finally when I kill the service process related to the DNS, the hotspot starts again to work. Evidently there is some misconfigurations with the DNS.

ShreyasZare commented 3 years ago

Hi, sorry for the late response.

Today I reinstalled the .NET 5 desktop runtime downloading it from the microsoft website. I rebooted the system and there were no malfunctioning in the hotspot functionality. So I tried to install the DNS server then and rebooted. And that is the precise moment in which the hotspot doesnt' work. Finally when I kill the service process related to the DNS, the hotspot starts again to work. Evidently there is some misconfigurations with the DNS.

Thanks for confirming this. You can now fix this by configuring DNS Server Local End Points in settings by removing the default end points and just entering the IP address that the computer has on the Ethernet or WiFi adapter. This will make the DNS server to listen for requests only on that specific IP address and allow the hotspot's DNS proxy to listen on "0.0.0.0:53" and work as expected.

You the same IP address on the Ethernet / WiFi that you used for DNS setting as your DNS server address in the network adapter so that your computer is able to use the DNS server. This will make the hotspot DNS proxy to also send response to the installed DNS server.

MarcoPellizzoni commented 3 years ago

"DNS Server Local End Points" Sorry, what do you mean?

I have another news. After rebooting, if I kill the process of the dns, I connect to the hotspot and then re-execute the dns, the connection of the phone remains stable.

MarcoPellizzoni commented 3 years ago

here there is the zip files installation logs https://drive.google.com/file/d/1k4WS6wga9o4E9s4BfnrkvJN-oM0l3SO_/view?usp=sharing

ShreyasZare commented 3 years ago

"DNS Server Local End Points" Sorry, what do you mean?

Check out the Settings tab on the DNS server web console. This setting tells the DNS server to listen on which IP address and port. The default "0.0.0.0" and "::" addresses means that the DNS server should listen on any IPv4 and IPv6 addresses.

The hotspot also runs its own DNS proxy which also uses "0.0.0.0" which means it also want to listen on any IP address.

Since only one app can listen on a specific IP and port, this is creating a conflict between DNS server and the hotspot DNS proxy. The one to start first captures the port and the second to start fails to run.

If you correct the DNS server local end points to listen on the specific IP address that you have on your WiFi adapter then it will allow the hotspot DNS proxy to work on "0.0.0.0" address. To make your system use the DNS server, you will then have to set the WiFi's IP address as your DNS address in the network adapter config.

I have another news. After rebooting, if I kill the process of the dns, I connect to the hotspot and then re-execute the dns, the connection of the phone remains stable.

This idea wont work out since doing this you are allowing the hotspot's DNS proxy to start on "0.0.0.0" and when you start the DNS server, it will fail to bind to "0.0.0.0" address and thus you wont be able to use the DNS server.

ShreyasZare commented 3 years ago

here there is the zip files installation logs https://drive.google.com/file/d/1k4WS6wga9o4E9s4BfnrkvJN-oM0l3SO_/view?usp=sharing

Check the DNS server logs instead of these logs.

MarcoPellizzoni commented 3 years ago

ops, this link was meant to be posted in the .NET 5 github page. Sorry.

ShreyasZare commented 3 years ago

ops, this link was meant to be posted in the .NET 5 github page. Sorry.

I saw that post on .NET 5 page. I think there is no issue with .NET 5 or with the DNS server. Its just that you need to configure the DNS correctly. I have done this on my laptop and both the DNS and the hotspot works as expected.

I can guess why you think its an issue with .NET5:

These events probably made you think its .NET 5 causing the hotspot to stop working. While it was all the time the DNS service running on "0.0.0.0:53" causing the hotspot DNS proxy app fail to start.

MarcoPellizzoni commented 3 years ago

mmmh. In fact I thought it was .net 5 fault, because i tried multiple times to install and reinstall .net 5 without having the dns installed. But it has passed some weeks from that tests, and now i don't know why it works. An other metter that bothered me was that my colleagues did not have to set up anything, they just install the dns and no other worries. When I have some time I will try to follow your last advice