[Dnsmasq-discuss] Behavior change of upstream servers set via DBus
Jerry Xiao
dnsmasq at mail.jerryxiao.cc
Tue Nov 9 14:10:26 UTC 2021
I have 30k+ lines of rules like "server=/somehost.tld/#" in my config.
What I need is to use the dhcp assigned dns server for those 30k+
domains and forward the others to 1.1.1.1.
This is not possible with your config.
> according to 2.85 docs (debian 11) the server=/#/1.1.1.1 makes no
> sense.
Yeah It's an undocumented behavior but it worked in 2.85.
On Tue, 2021-11-09 at 13:52 +0100, Matus UHLAR - fantomas via Dnsmasq-
discuss wrote:
> On 09.11.21 19:59, Jerry Xiao wrote:
> > So how can I achieve the same behavior as "server=/#/1.1.1.1" from
> > dnsmasq 2.85?
>
> according to 2.85 docs (debian 11) the server=/#/1.1.1.1 makes no
> sense.
>
> I don't have older docs around, and I haven't found that syntax in
> changelog
> (https://thekelleys.org.uk/dnsmasq/CHANGELOG), what do you expect it to
> do?
>
> you said that the upstream server is 192.168.1.1 (no matter, if set in
> config file, via dbus or in resolv.conf), so all queries are forwarded
> to
> it.
>
> you also set:
> server=/google.com/#
>
> which means to send requests for google.com and subdomains to default
> server
> (192.168.1.1). Just as you describe.
>
> if you want to send all requests except of google.com to 1.1.1.1, you
> must:
>
> 1. set default server to 1.1.1.1
>
> server=1.1.1.1
>
> 2. point google.com to 192.168.1.1
>
> server=/google.com/192.168.1.1
>
> that's it.
>
> > On Tue, 2021-11-09 at 10:33 +0100, Matus UHLAR - fantomas via
> > Dnsmasq-
> > discuss wrote:
> > > On 09.11.21 17:02, Jerry Xiao wrote:
> > > > With dnsmasq 2.85 I was able to do the following:
> > > > 1. set upstream servers (lets say 192.168.1.1) via dbus from the
> > > > dhcp
> > > > client, in my case it was networkmanager.
> > > > 2. add the following config (dnsmasq 2.85):
> > > > server=/google.com/#
> > > > server=/#/1.1.1.1
> > > >
> > > > So that only google.com and its subdomains are forwarded to the
> > > > upstream server (192.168.1.1) while requests for any other
> > > > domains
> > > > went
> > > > ahead to 1.1.1.1.
> > >
> > > > However with the recent update of dnsmasq 2.86 I noticed that the
> > > > same
> > > > config above would not work. It seems that the right syntax for
> > > > "server=/#/1.1.1.1" has become "server=//1.1.1.1". This isn't the
> > > > biggest problem though.
> > > >
> > > > with this new config (dnsmasq 2.86):
> > > > server=/google.com/#
> > > > server=//1.1.1.1
> > > >
> > > > Now every single domain (including google.com) is forwarded to
> > > > the
> > > > upstream server (192.168.1.1) set via the dbus api instead of
> > > > 1.1.1.1,
> > >
> > > that's because the:
> > >
> > > server=/google.com/#
> > >
> > > means to send the "google.com" requests to default upstream server:
> > >
> > > The special server address '#' means, "use the standard
> > > servers",
> > > so
> > > --server=/google.com/1.2.3.4 --server=/www.google.com/# will
> > > send
> > > queries for *.google.com to 1.2.3.4, except *www.google.com
> > > which
> > > will
> > > be forwarded as usual.
> > >
> > > while the:
> > >
> > > server=//1.1.1.1
> > >
> > > means to send UNQUALIFIED hosts to 1.1.1.1
> > >
> > >
> > > > which is an unexpected behavior change from the previous version.
> > > > Setting the upstream server (192.168.1.1) with this config line
> > > > "server=192.168.1.1" without dbus works, though.
> > > >
> > > > Is there something wrong with the new upstream server selection
> > > > logic?
>
More information about the Dnsmasq-discuss
mailing list