1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

DNS Problems

Discussion in 'Tomato Firmware' started by Edirol, Jun 9, 2008.

  1. Edirol

    Edirol Guest


    I'm experiencing some odd behaviour with DNS under tomato.


    I am ssh'd into tomato and run the following command (domains changed)

    # nslookup domain.com alternate_NS.com
    Server: default.com

    Name: domain.com

    The problem is that it uses the default.com (from my ISP's) DNS server instead of the one I specified, IE: alternate_NS.com

    It will use an alternate however if I specify alternate_NS.com in IP format vs hostname.

    I cannot figure out how to "flush" the local DNS cache with tomato. I have tried restarting the dnsmasq service and/or played around with it's arguments (--clear-on-reload, -n) but it will always cache the result.

    IE. zone.com is hosted on ns1.com with a fictional IP of
    nslookup zone.com returns
    I change the A record for zone.com on ns1.com to
    I run:
    nslookup zone.com and it STILL returns

    Restarting dnsmasq didn't seem to do anything, and I can't find a nscd like daemon running on the router.

    If anyone has any suggestions, please let me know. I am trying to script some firewall rules that rely on hostnames that change IPs from time to time.

    - Edirol
  2. HennieM

    HennieM Network Guru Member

    The nslookup utility in Tomato is a watered down one, as is just about every utility found in set top boxes to make it fit into the limited flash/RAM, so don't expect dig/host type features from this. (This does not mean that the GetHostByName resolve process in Tomato's IP stack is watered down ;) To find out about the capabilities of this nslookup, check out busybox, bearing in mind that not all the available capabilities that nslookup has in busybox, has necessarily been compiled into Tomato.

    In my Tomato 1.19. nslookup also seems to not resolve servers by name (from a sniff of what nslookup sends to the dns server, it just does a PTR query - no A? query - on the server). If the server is specified by name, it silently ignores it, and uses the default server it seems.

    To solve your problem, I'd suggest:
    1) Are you not using one of those hosts files which lists ad sites and the likes as
    2) Try turning the Tomato dnsmasq off, and specify another DNS server, and see if the 127... still pops up.
    3) dnsmasq can be made to use/not use at least 2 hosts files. In Tomato, in addition to the normal /etc/hosts, it also uses /etc/hosts.dnsmasq - try turning off the use of those hosts files. See dnsmasq man page (google found one here http://www.thekelleys.org.uk/dnsmasq/docs/dnsmasq-man.html).
    4) Also check out the dnsmasq options:
    -c, --cache-size=<cachesize>
    Set the size of dnsmasq's cache. The default is 150 names. Setting the cache size to zero disables caching.
    -N, --no-negcache
    Disable negative caching. Negative caching allows dnsmasq to remember "no such domain" answers from upstream nameservers and answer identical queries without forwarding them again.

Share This Page