-4

I need to resolve both my local network devices + public internet domains from my windows PC. My local ISP's DNS server is quite sucky at resolving public domains so I want to use Google DNS for higher reliability, but also want to be able to access the local network resources in my subnet.

Although I can statically configure the NIC properties to have both Primary and Seconday DNS setting, but I also happen to move with my laptop across networks.(home\office) So I want the Local DNS to be always dynamically set but the Google DNS to remain statically configured on my NIC always.

What is the best possible approach to get DNS from DHCP and add GoogleDNS on top of it statically.

closed as off-topic by yoonix, Iain, MadHatter, EEAA Aug 18 '16 at 6:36

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions on Server Fault must be about managing information technology systems in a business environment. Home and end-user computing questions may be asked on Super User, and questions about development, testing and development tools may be asked on Stack Overflow." – yoonix, Iain, MadHatter, EEAA
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 3
    Fix your local DNS server. – EEAA Aug 18 '16 at 5:27
  • How can i fix my ISPs DNS server ? – Vishal Naidu Aug 25 '16 at 20:50
  • You can't fix your ISPs DNS server, but you don't need to use it. Host your own DNS server. – EEAA Aug 25 '16 at 21:02
  • @VishalNaidu You changed the requirements and details in your question... how can we help you if you're doing that? Your question is also a little confusing and you're asking to do something unusual. Also there is some question as to whether or not this is a business environment problem. Maybe you can ask a new question (since this one got closed) that is more clear and explain your problem in detail. How to solve the problem can be left up to whoever answers. – Ryan Babchishin Aug 25 '16 at 21:35
  • I dont think i changed any requirements, i just changed some sentences to be more specific. – Vishal Naidu Aug 26 '16 at 2:10
2

The best way in my opinion is to have a local forwarding DNS server.

Perhaps your DNS server is contacting the root servers? You just need to have it forward requests to somewhere fast - Google.

A DNS server can store your local records, and when a record isn't found it will forward the request to Google's DNS servers. You can have the added benefit of caching results on your server for better performance.

DNSMasq, unbound, bind do this. If you're on Windows, I can't give any suggestions - you haven't mentioned your DNS server OS. I think some routers have this functionality built in too.

According to this article, DNSMasq forwards by default to whatever is in /etc/resolv.conf. So it seems all you need to do is add your local host entries.

https://wiki.debian.org/HowTo/dnsmasq

So you get this:

request -> local dns (return if found) -> google dns ->
result -> local dns (add to cache) -> requester

Unbound works on Windows. Some others I listed may too. I'm sure there are many options for you.

https://www.unbound.net/

Now that you've explained a bit more about your situation You will need to configure the DNS server on your workstation and tell it about any internal domains and that it should query your existing slow DNS server for that info. It can then query google for everything else. You'll have to configure your workstation to query 127.0.0.1 instead of the regular slow DNS server. If you enable caching, you may find that internal lookups are faster sometimes too.

  • I am unfortunately on the client box and do not have any control on the DNS or DHCP servers in my local network. Is it possible to configure the client machine ? – Vishal Naidu Aug 18 '16 at 5:53
  • @VishalNaidu Yes you can run a dns server on your personal computer. You'll have to change your resolver to query 127.0.0.1 instead of your regular DNS servers. – Ryan Babchishin Aug 18 '16 at 6:34
  • @VishalNaidu Unbound works on windows, see my answer – Ryan Babchishin Aug 18 '16 at 6:39
  • You mean from every device i have i should run a dns server ? – Vishal Naidu Aug 25 '16 at 20:48
  • @VishalNaidu You have many workstations? You made it sound like just one. Too bad you can't just fix your slow DNS servers. You could run a DNS server on every workstation if you really need the speed. Ubuntu Linux does it on every desktop install by default. – Ryan Babchishin Aug 25 '16 at 21:19
0

If you're on Windows, this should work in an administrative PowerShell window;

$IntName = "Wi-Fi" ; Set-DnsClientServerAddress -InterfaceAlias $IntName -ResetServerAddresses ; Set-DnsClientServerAddress -InterfaceAlias $IntName -ServerAddresses ((Get-DnsClientServerAddress -InterfaceAlias $IntName).ServerAddresses,"8.8.8.8")

It basically resets your DNS setting to get the DNS server that your DHCP provides, and converts it to a static setting adding 8.8.8.8 in the end.

"Wi-Fi" is my network connection's name. Yours might be "Local Area Connection", "Ethernet" or something like that.

This might also work.

  • Wont this reset my local DNS server and always use public google dns ? – Vishal Naidu Aug 18 '16 at 5:58
  • That script gets your current DNS server and adds 8.8.8.8 to it. So, if you get 192.168.0.1 from your DHCP server, after running that, you'll have 192.168.0.1 as primary and 8.8.8.8 as secondary. – Mer Aug 18 '16 at 6:16
  • @Mer That won't work. All requests will go to 192.168.0.1, so it'll still be slow. – Ryan Babchishin Aug 18 '16 at 6:49
  • Yes, but it will ask 8.8.8.8 if it can't resolve from your local DNS server in the end. You can change the order but that might result in not being able to resolve local names. If you want to do it anyway, change the last part of the script after -ServerAddresses with ("8.8.8.8",(Get-DnsClientServerAddress -InterfaceAlias $IntName).ServerAddresses) – Mer Aug 18 '16 at 6:55
  • Thanks for clarifying. Is there a way this script can run automatically whenever client machine gets net DHCP Lease ? – Vishal Naidu Aug 18 '16 at 16:02

Not the answer you're looking for? Browse other questions tagged or ask your own question.