Adding an alternate DNS server

Good ideas? Share with us!
Post Reply
Binkem
Posts: 388
Joined: 10 Jul 2008, 02:26

Adding an alternate DNS server

Post by Binkem » 29 Oct 2012, 09:05

Hi,

Het user interface on my bubba only accepts a single DNS server. Most ISP's however have two adresses. Last n ight there one of my ISP's DNS servers was down and I had to manually change the DNS on my B3 in order to regain internet connection. Is it possible to add more than one DNS-server in the B3? If so I'd like to be able to add two servers from the web-interface.

Martijn

Gordon
Posts: 1324
Joined: 10 Aug 2011, 03:18

Re: Adding an alternate DNS server

Post by Gordon » 29 Oct 2012, 09:21

As a rule public services supply at least two DNS servers through their DHCP offerings. The dialogue you're referring to is for fixed IP settings only.

IMO the DNS entry should read 127.0.0.1 - I think it's rather pointless to have the B3 serve as a DNS server for LAN clients and then not use this local DNS service itself.

Binkem
Posts: 388
Joined: 10 Jul 2008, 02:26

Re: Adding an alternate DNS server

Post by Binkem » 29 Oct 2012, 16:45

I've got a fixed IP-adress and my ISP does't allow DHCP configuration for this fixed IP. I don't think I'll get DNS information if i set my DNS server to 127.0.0.1

Gordon
Posts: 1324
Joined: 10 Aug 2011, 03:18

Re: Adding an alternate DNS server

Post by Gordon » 30 Oct 2012, 06:09

Binkem wrote:I've got a fixed IP-adress and my ISP does't allow DHCP configuration for this fixed IP. I don't think I'll get DNS information if i set my DNS server to 127.0.0.1
Obviously you'll need to reconfigure DNSmasq with its own forwarders for this. Luckily this is a fairly simple fix for which you only need to tell DNSmasq to use an alternate resolv.conf file:

First create a copy of your original resolv.conf:

Code: Select all

root@b3:~# cp /etc/resolv.conf  /var/lib/dnsmasq/resolv.conf
Next tell DNSmasq to use the copy:

Code: Select all

root@b3:~# echo "resolv-file=/var/lib/dnsmasq/resolv.conf" > /etc/dnsmasq.d/forwarders.conf
After restarting DNSmasq you can now set 127.0.0.1 as your DNS server.

GodfatherB
Posts: 55
Joined: 03 Jan 2012, 18:17

Re: Adding an alternate DNS server

Post by GodfatherB » 26 Nov 2012, 13:36

I wanted to add another DNS at my static IP settings on the WAN port, so I followed these instructions, and it seems it works. I even added another nameserver line in the /var/lib/dnsmasq/resolv.conf file... don't know if it has any effect though.

I would however like to understand mechanics of this operation and of how this dnsmasq works in this case... I would appreciate if somebody could please explain how all of this works... browsers checks local DNS (at 127.0.0.1), then what happens?

Gordon
Posts: 1324
Joined: 10 Aug 2011, 03:18

Re: Adding an alternate DNS server

Post by Gordon » 26 Nov 2012, 16:58

GodfatherB wrote:...browsers checks local DNS (at 127.0.0.1), then what happens?
No

DNSmasq's DHCP server hands out your B3's LAN address as the DNS server for connected workstations. Browsers on thos workstations will therefore send their domain requests to 192.168.10.1 (or whatever you changed it into) and if DNSmasq doesn't have that address cached it will forward the request to the configured servers in (the alternate) resolv.conf file.

The fix of having the alternate resolv.conf file and pointing the B3's system resolv.conf file to localhost (127.0.0.1) just makes the B3 itself also use the DNS cache, which speeds up DNS dependent services and makes them less vulnerable to network hick-ups. If you experience slow networking from time to time this can also help counter problems with installing software through aptitude/apt-get.

GodfatherB
Posts: 55
Joined: 03 Jan 2012, 18:17

Re: Adding an alternate DNS server

Post by GodfatherB » 27 Nov 2012, 13:56

OK, so basically B3 is now DNS sever for all the machines connected to it. And if I understand you correctly, the more websites users visit, the more populated is the cache and so the whole thing should work faster (the DNS name reslove). Does this in essence mean that if there were no nameservers defined in the forwarders.conf that our B3's DNS would not be able to resolve any address? Does every DNS in existence have its own forarders?

nobody
Posts: 226
Joined: 10 Mar 2012, 14:46

Re: Adding an alternate DNS server

Post by nobody » 27 Nov 2012, 13:59

Yes, the root servers are always hardcoded in any dns server.

Gordon
Posts: 1324
Joined: 10 Aug 2011, 03:18

Re: Adding an alternate DNS server

Post by Gordon » 27 Nov 2012, 15:28

nobody wrote:Yes, the root servers are always hardcoded in any dns server.
Is that really true? I know in Bind they are in a separate config file (which would rule out hardcoding) and I wonder if DNSmasq would have these since it's not its objective to be a true DNS server.
GodfatherB wrote:OK, so basically B3 is now DNS sever for all the machines connected to it.
It already was. It just didn't use the DNS cache for itself

nobody
Posts: 226
Joined: 10 Mar 2012, 14:46

Re: Adding an alternate DNS server

Post by nobody » 27 Nov 2012, 16:24

Gordon wrote: Is that really true? I know in Bind they are in a separate config file (which would rule out hardcoding) and I wonder if DNSmasq would have these since it's not its objective to be a true DNS server.
Semantics. By hardcoded i mean supplied with the installer package in a config file. They are not hardcoded in that they are compiled in. Wat it does mean is that you cannot get a primary dns answer ina a way similar to the request for a dhcp lease. In the last case the client just shouts into the broadcast channel to anone willing to listen. For dns you always need to know at least one single other nameserver for it to work.

Darrellham
Posts: 3
Joined: 01 Oct 2015, 15:28

Adding an alternate DNS server

Post by Darrellham » 03 Oct 2015, 04:36

I am using PPPoE with alternate DNS servers and those are displayed.

To test, I removed them. My ISPs DNS servers were not displayed in their place. Not sure if that was the intention, or if it was just to display alternates if configured?
Biinary options system

Gordon
Posts: 1324
Joined: 10 Aug 2011, 03:18

Re: Adding an alternate DNS server

Post by Gordon » 05 Oct 2015, 03:11

You are replying to some really ancient messages. But here it is:

If you have alternate DNS servers configured with your PPPoE connection you must have set "nopeerdns" property to your connection. Meaning it will disregard whatever is in the DNS field that your ISP feeds you in the DHCP offering. This is independent of whether you have valid entries in your resolv.conf or not.

A similar setting applies to your regular DHCP client where you can also configure what fields you want to consider in DHCP offerings.

Post Reply