bitbeans / SimpleDnsCrypt

A simple management tool for dnscrypt-proxy
https://simplednscrypt.org
MIT License
2.29k stars 233 forks source link

Revert back to system DNS fails when using static IP in adapter setings #304

Open mrghosh opened 6 years ago

mrghosh commented 6 years ago
  1. I started Simple DNSCrypt and started the service (slider) and clicked on my network card to activate (turned green from grey)
  2. DNS requests are being resolved successfully. Webpages are opening
  3. I decided to stop using it and I clicked on the activated network card on the software interface to deactivate it (the card became grey). then stopped the service (slider)
  4. All DNS requests stopped working. Web pages are not opening "error name resolution"

How do I stop it completely and revert to system DNS? The only way it is working if I restart the computer after deactivating the service.

v 0.5.4(x86) dnscrypt proxy v2.0.8

Skcyte commented 6 years ago

Just make sure on your LAN setting change the DNS to set automatically. The active network card UI can be buggy sometimes.

slyphnier commented 6 years ago

dnscrypt system work by making "DNScache" in your PC instead asking for DNS-resolve to specific DNS-IP-address

so by enabling simplednscrypt, it will automatically set DNS IP address set to 127.0.0.1 (local ip address) when you disable it, it not reverting DNS IP to automatic, so as it stay set to 127.0.0.1 but the resolving system is disabled you end up cannot resolving internet address

mrghosh commented 6 years ago

Thank you Skcyte and slyphnier for telling how dnscrypt works.

After some trials, I have found that:

  1. When I enable dnscrypt on a network card from GUI, it simply changes DNS value in adapter settings to localhost (127.0.0.1)
  2. When I disable dnscrypt on a network card from GUI, it simply changes DNS value in adapter settings to 'Obtain DNS server address automatically' and removes 127.0.0.1.

The above works flawlessly on most of the times but it fails at a specific situation. If we use static IP in adapter settings, windows force users to manually specify DNS address. You can't specify static IP manually and keep DNS automatic at the same time. So, when dnscrypt tries to revert to 'obtain DNS server address automatically', it fails and makes browsing impossible because there is no DNS server specified.

(screenshot: notice that the automatic DNS option is disabled when using staic IP) capture

Possible Solution: When enabling dnscrypt, keep note of the current DNS settings (ie, whether using automatic DNS settings or specific DNS server). If the user is using specific servers, then revert to those servers without trying to set automatically.

Thank you :)