Page 3 of 3 FirstFirst 123
Results 21 to 27 of 27

Thread: Need dns cache-dnsmasq

  1. #21
    Join Date
    Nov 2009
    Location
    Segur De Calafell, Spain
    Beans
    11,660
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Need dns cache-dnsmasq

    I would start by listing the ISP nameservers, not the router.
    As for the loopback address, I'm not sure if it would help. Investigate a little if it helps dnsmasq with caching, otherwise if it doesn't, no need to list it I think.
    Darko.
    -----------------------------------------------------------------------
    Ubuntu 12.04 LTS 64bit & Windows 7 Ultimate 64bit

  2. #22
    Join Date
    Jun 2012
    Location
    Isaan (the REAL Thailand)
    Beans
    172
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Need dns cache-dnsmasq

    That broke everything. I remember long before in this process trying to get eth0 going as static and couldn't. Server is off line and ifconfig shows neither eth0 or eth1 getting an ip address. Of course that eliminates the client as well. BTW I tried it without change to resolve.conf and with adding a line ` search myname.no-ip.org' , although it's set for 10 minute refresh, so maybe I should wait (?). I don't remember the suggested format for the nameserver entries there, seems like it was something with / instead of- or .

  3. #23
    Join Date
    Jun 2012
    Location
    Isaan (the REAL Thailand)
    Beans
    172
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Need dns cache-dnsmasq

    So, I'm right where I started, except I guess I'll give up on caching with a dhcp eth0. Funny too as the router is assigning a single ip to eth0 and yet if I set eth0 to static, it falls over. Everything else is going good. The new term starts the 29th (Oct.) and I'll have it at school with a better router. See what happens then. I have read in tutorials for other caching packages that static ip is a necessity.

  4. #24
    Join Date
    Mar 2005
    Beans
    211

    Re: Need dns cache-dnsmasq

    Quote Originally Posted by hawaiiman View Post
    I saw a man page for resolvconf in ubuntu that stated that dnsmasq would go to resolv.conf for nameservers (added s for resolvconf) and that would look to those listed in /etc/network/interfaces. [...] After trying several variations, I found that dnsmasq default goes to /etc/resolv.conf for a list of nameservers.
    When resolvconf and dnsmasq are installed, dnsmasq obtains its list of forwarder nameserver addresses from resolvconf's database instead of from /etc/resolv.conf.

    Quote Originally Posted by hawaiiman View Post
    resolv.conf queries /etc/network/interfaces and will add those listed there.
    What happens, more precisely, is that resolvconf generates resolv.conf from information that comes from /etc/network/interfaces, among other sources. See the resolvconf man page for details.

  5. #25
    Join Date
    Mar 2005
    Beans
    211

    Re: Need dns cache-dnsmasq

    Dnsmasq's cache size is controlled using the cache-size option either on the command line or in one of dnsmasq's configuration files. Make sure that the cache size is larger than zero. You may want to set the size to a three- or four-digit number.

  6. #26
    Join Date
    Jun 2012
    Location
    Isaan (the REAL Thailand)
    Beans
    172
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Need dns cache-dnsmasq

    I realize that. Cache set to 300 previously.
    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 this 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. /etcf/resolv.conf deletes all entries at reboot and defaults to the router as the nameserver, which seems to prevent caching.

  7. #27
    Join Date
    Mar 2005
    Beans
    211

    Re: Need dns cache-dnsmasq

    Quote Originally Posted by hawaiiman View Post
    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.
    Last edited by jdthood; November 12th, 2012 at 09:21 PM. Reason: Fix typo

Page 3 of 3 FirstFirst 123

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •