Discussion:
[Dnsmasq-discuss] Multiple Resolv Files?
Petri Savilahti
2008-11-07 11:55:14 UTC
Permalink
Is it possible to read nameservers from multiple resolv files? For
example from the normal /etc/resolv.conf and the /etc/ppp/resolv.conf.

- Petri
Simon Kelley
2008-11-07 12:05:21 UTC
Permalink
Post by Petri Savilahti
Is it possible to read nameservers from multiple resolv files? For
example from the normal /etc/resolv.conf and the /etc/ppp/resolv.conf.
Yes, you can specify as many as you like and dnsmasq will use the one
which was altered last.

Simon.
Helmut Hullen
2008-11-07 12:10:00 UTC
Permalink
Hallo, Petri,
Post by Petri Savilahti
Is it possible to read nameservers from multiple resolv files? For
example from the normal /etc/resolv.conf and the
/etc/ppp/resolv.conf.
If I have understood the mechanics correct: first hit wins. And "/etc/
resolv.conf" is asked/searched first.

Viele Gruesse!
Helmut
Helmut Hullen
2008-11-07 12:20:00 UTC
Permalink
Hallo, Simon,
Post by Simon Kelley
Post by Petri Savilahti
Is it possible to read nameservers from multiple resolv files? For
example from the normal /etc/resolv.conf and the
/etc/ppp/resolv.conf.
Yes, you can specify as many as you like and dnsmasq will use the one
which was altered last.
Ok - I changed "/etc/resolv.conf" last ...

But there is (or may be) another problem:
The ppp daemon may change "/etc/ppp/resolv.conf" (you can tell him what
and where to change). And in this file you cannot tell "domain xyz" and
the LAN nameserver, the ppp daemon writes it completely new.

Viele Gruesse!
Helmut
Petri Savilahti
2008-11-07 12:57:38 UTC
Permalink
Hallo Helmut,

Danke schoen fuer deine Hilfe!

What if the primary link (/etc/resolv.conf) goes down? Dnsmasq will
not get any replies using nameservers from this file. Does dnsmasq
automatically read then the /etc/ppp/resolv.conf?

- Petri
Post by Helmut Hullen
Hallo, Simon,
Post by Simon Kelley
Post by Petri Savilahti
Is it possible to read nameservers from multiple resolv files? For
example from the normal /etc/resolv.conf and the
/etc/ppp/resolv.conf.
Yes, you can specify as many as you like and dnsmasq will use the one
which was altered last.
Ok - I changed "/etc/resolv.conf" last ...
The ppp daemon may change "/etc/ppp/resolv.conf" (you can tell him what
and where to change). And in this file you cannot tell "domain xyz" and
the LAN nameserver, the ppp daemon writes it completely new.
Viele Gruesse!
Helmut
_______________________________________________
Dnsmasq-discuss mailing list
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
Jan 'RedBully' Seiffert
2008-11-07 18:46:27 UTC
Permalink
Post by Petri Savilahti
Hallo Helmut,
Danke schoen fuer deine Hilfe!
What if the primary link (/etc/resolv.conf) goes down? Dnsmasq will
not get any replies using nameservers from this file. Does dnsmasq
automatically read then the /etc/ppp/resolv.conf?
dnsmask reads all specified files on startup, creates a list of upstream dns
servers, then chooses the one which "works best" (first querys go round robin,
to measure). If this choosen server goes down, it reelects another one from its
list. Additionally, if any resolvfile gets rewritten while dnsmask is running,
it rereads the file and updates its list.

Its simple as this, but it is not simple to say which server dnsmask will choose ;)
Post by Petri Savilahti
- Petri
Greetings
Jan

[snip]
--
Fun things to slip into your budged:
Traffic shaping on the loopback interface
Petri Savilahti
2008-11-25 12:15:21 UTC
Permalink
Post by Jan 'RedBully' Seiffert
Post by Petri Savilahti
What if the primary link (/etc/resolv.conf) goes down? Dnsmasq will
not get any replies using nameservers from this file. Does dnsmasq
automatically read then the /etc/ppp/resolv.conf?
dnsmask reads all specified files on startup, creates a list of upstream dns
servers, then chooses the one which "works best" (first querys go round robin,
to measure). If this choosen server goes down, it reelects another one from its
list. Additionally, if any resolvfile gets rewritten while dnsmask is running,
it rereads the file and updates its list.
Its simple as this, but it is not simple to say which server dnsmask will choose ;)
I tried this with the latest dnsmasq-2.46 and can't get it working. I
configured a static
configuration (IP address and /etc/resolv.conf) for the ADSL
connection and dynamic
DHCP configuration (IP address and /var/run/ppp/resolv.conf) for the
mobile connection.

I have the following lines in my dnsmasq.conf
resolv-file=/etc/resolv.conf
resolv-file=/var/run/ppp/resolv.conf.
log-queries.

When I reboot my machine I get the following lines to my /var/log/messages:
daemon.info dnsmasq[2862]: started, version 2.46 cachesize 150
daemon.warn dnsmasq[2862]: overflow: 7 log entries lost
daemon.info dnsmasq[2862]: using nameserver X.Y.182.230#53
daemon.info dnsmasq[2862]: using nameserver X.Y.180.230#53

and 5 sec later when the mobile connection starts:
daemon.info dnsmasq[2862]: reading /var/run/ppp/resolv.conf
daemon.info dnsmasq[2862]: using nameserver Z.M.0.47#53
daemon.info dnsmasq[2862]: using nameserver Z.N.54.100#53.

Dnsmasq will forward only to the last two DNS servers (Z.M.0.47 and
Z.N.54.100) even
if it would not get any response from them (mobile connection down).
The first two
nameservers (X.Y.182.230 and X.Y.180.230) are not even tried.

Any help would be appreciated.

- Petri
Simon Kelley
2008-11-25 21:04:33 UTC
Permalink
Post by Petri Savilahti
Post by Jan 'RedBully' Seiffert
Post by Petri Savilahti
What if the primary link (/etc/resolv.conf) goes down? Dnsmasq will
not get any replies using nameservers from this file. Does dnsmasq
automatically read then the /etc/ppp/resolv.conf?
dnsmask reads all specified files on startup, creates a list of upstream dns
servers, then chooses the one which "works best" (first querys go round robin,
to measure). If this choosen server goes down, it reelects another one from its
list. Additionally, if any resolvfile gets rewritten while dnsmask is running,
it rereads the file and updates its list.
Its simple as this, but it is not simple to say which server dnsmask will choose ;)
I tried this with the latest dnsmasq-2.46 and can't get it working. I
configured a static
configuration (IP address and /etc/resolv.conf) for the ADSL
connection and dynamic
DHCP configuration (IP address and /var/run/ppp/resolv.conf) for the
mobile connection.
I have the following lines in my dnsmasq.conf
resolv-file=/etc/resolv.conf
resolv-file=/var/run/ppp/resolv.conf.
log-queries.
daemon.info dnsmasq[2862]: started, version 2.46 cachesize 150
daemon.warn dnsmasq[2862]: overflow: 7 log entries lost
daemon.info dnsmasq[2862]: using nameserver X.Y.182.230#53
daemon.info dnsmasq[2862]: using nameserver X.Y.180.230#53
daemon.info dnsmasq[2862]: reading /var/run/ppp/resolv.conf
daemon.info dnsmasq[2862]: using nameserver Z.M.0.47#53
daemon.info dnsmasq[2862]: using nameserver Z.N.54.100#53.
Dnsmasq will forward only to the last two DNS servers (Z.M.0.47 and
Z.N.54.100) even
if it would not get any response from them (mobile connection down).
The first two
nameservers (X.Y.182.230 and X.Y.180.230) are not even tried.
Any help would be appreciated.
- Petri
Dnsmasq uses only one resolv-file at a time, and uses the one which
changed last. That explains what you are seeing:
/var/run/ppp/resolv.conf changed last, so it gets used.

When you say the your connections "go down" are they actually being
removed, or just not working? If you can arrange so that you use one
connection at a time, then you can make pppd or DHCP or whatever touch a
resolv file as the connection comes up, and dnsmasq's resolv-file
reading logic will work.

If both connections are there all the time, but sometime the DNS servers
just don't respond, then the best thing to do is to put all the possible
nameservers into a static resolv.conf or /etc/dnsmasq.conf. Dnsmasq will
start by sending a query to all the servers and then use the one which
answers first.

Cheers,

Simon.

Loading...