Originally Posted by
hawaiiman
As I said previously, the problem seems to arise from /etc/resolv.conf looking for a list of nameservers in the information listed in /etc/network/interfaces [T]his is all fine with a machine with a static ip on the wan side. Unfortunately, this eth0 is dynamic, and thus no nameservers are listed for eth0. /etc/resolv.conf deletes all entries at reboot and defaults to the router as the nameserver, which seems to prevent caching.
Your posts would be easier to read if you distinguished between resolvconf, a program, and /etc/resolv.conf, a file.
If I understand correctly, if you have the following in /etc/network/interfaces
Code:
iface eth0 inet static
address 192.168.1.99
...
dns-nameservers w.x.y.z
then dnsmasq uses w.x.y.z as its upstream recursive nameserver and dnsmasq caches the replies; all is well.
However, if you have the following in /etc/network/interfaces
Code:
iface eth0 inet dhcp
then dnsmasq uses the router's nameserver as its upstream recursive nameserver and does not cache.
My guess is that the router's nameserver sends out results with TTL=0, causing dnsmasq not to cache them. I don't know of any way to cause dnsmasq to override TTL values coming from upstream.
I'll assume that the problem is to be solved by using nameserver w.x.y.z in preference to the router nameserver. Do the following. (1) In /etc/network/interfaces add a "dns-nameservers" line to the "iface eth0" stanza.
Code:
iface eth0 inet dhcp
dns-nameservers w.x.y.z
(2) In /etc/resolvconf/interface-order add a line "eth0.dhcp" before the line "eth*". This will cause the nameserver address w.x.y.z to be prioritized over the address provided via DHCP (which has the record name "eth0.dhclient").
Code:
$ diff -u interface-order_ORIG interface-order
--- interface-order_ORIG 2012-11-12 21:04:51.341700438 +0100
+++ interface-order 2012-11-12 21:05:37.569702413 +0100
@@ -9,6 +9,7 @@
hso*
em+([0-9])?(_+([0-9]))*
p+([0-9])p+([0-9])?(_+([0-9]))*
+eth0.dhcp
eth*
ath*
wlan*
(3) Do the following in a terminal
Code:
sudo ifdown eth0
sudo ifup eth0
In /etc/resolv.conf you should now have only one "nameserver" line, the following.
Code:
nameserver 127.0.0.1
To see what nameserver address(es) dnsmasq is forwarding to, look in /var/run/dnsmasq/resolv.conf.
Bookmarks