Define DNS priority

If your problem doesn't fall into one of the other categories, report it here.

Moderator: Moderators

Post Reply
nbexiga
Posts: 10
Joined: Tue Sep 15, 2015 10:56 am

Define DNS priority

Post by nbexiga »

Hi

I have gargoyle 8.0 and i defined 4 dns in the configuration.
But i want to ensure that i can define the DNS search order. for 1st to the last one that i want.

is it possible?
thanks

shm0
Posts: 67
Joined: Sat Sep 19, 2015 10:06 am

Re: Define DNS priority

Post by shm0 »

Hi
Add the following line to your dhcp config in /etc/config/dhcp
(You have to login via ssh and edit it with vi or use winscp to edit the file)

option strictorder '1'

nbexiga
Posts: 10
Joined: Tue Sep 15, 2015 10:56 am

Re: Define DNS priority

Post by nbexiga »

Hi

but how do i define what DNS is the 1st and the rest of the order?
that line ony say to 1?
thanks

shm0
Posts: 67
Joined: Sat Sep 19, 2015 10:06 am

Re: Define DNS priority

Post by shm0 »

Hi
open /etc/config/network
search for

Code: Select all

config interface 'wan'
edit

Code: Select all

option dns 'IP1 IP2 IP3'
The first dns listed has highest priority.
Second dns listend second highest priority.
And so on.

Do the same for

Code: Select all

config interface 'lan'

nbexiga
Posts: 10
Joined: Tue Sep 15, 2015 10:56 am

Re: Define DNS priority

Post by nbexiga »

MANY THANKS ;)

shm0
Posts: 67
Joined: Sat Sep 19, 2015 10:06 am

Re: Define DNS priority

Post by shm0 »

No problem nbexiga, you're welcome :)

rseiler
Posts: 208
Joined: Sun Dec 15, 2013 12:31 am

Re: Define DNS priority

Post by rseiler »

@shm0, a follow-up or two on this if you don't mind, as I try to understand the ramifications.

I only started wondering about all this after noting that the DNS order as listed on the Connection/Basic page and /etc/config/network do not agree with what's shown on the Status page.

Just to get this out of the way, I noticed that once custom DNS are set in the GUI, the lines in /etc/config/network are already done, at least they are today (not sure about a year ago).

But I'm wondering whether the strictorder line in /etc/config/dhcp is advisable.

First, in looking up what it meant, I found:
By default, dnsmasq will send queries to any of the upstream servers it knows about and tries to favour servers that are known to be up. Setting this flag forces dnsmasq to try each query with each server strictly in the order they appear in /etc/resolv.conf
OK, so I looked there and found this:
search lan
nameserver 127.0.0.1
Only localhost is there. So in the case of a router, is strictorder doing anything at all?

In looking for more on this, I found this post from a longtime poster over on DD-WRT:
And btw, NEVER EVER use strict-order w/ DNSMasq. That directive does NOT work the way ppl think. I have no idea why they suddenly added it to the GUI. It's misleading. Strict-order tries the first nameserver, and if it fails, returns an error to the client, then waits for the client to retry (assuming it does, which is part of the problem, many clients don't). Then it tries the second nameserver, and if it fails, waits for the client to try again. And so on. It has the effect of breaking DNS if it happens the first nameserver doesn't work. Just a really dumb option that should never have been added to DNSMasq imo.

rseiler
Posts: 208
Joined: Sun Dec 15, 2013 12:31 am

Re: Define DNS priority

Post by rseiler »

Can any light be shed on these questions? If it is a sound practice, and it sounds like it isn't, maybe the option should be put in the UI? Or maybe there's a better way?

Because of this, I'm reminded of the problem again.
https://www.quad9.net

rseiler
Posts: 208
Joined: Sun Dec 15, 2013 12:31 am

Re: Define DNS priority

Post by rseiler »

Now 1.1.1.1 has come along and is one that many might actually want to position first and only use their ISP's DNS as a fallback.

DNS options are more varied than ever, so shouldn't the UI be able to handle ordering, and in the process maybe even add the words "Primary" and "Secondary" etc to make it clear that they're not just being added randomly?

Also, there's the whole outstanding issue with 'strictorder'. which might become moot if changes are made to the UI, but in the meantime is relevant.

Post Reply