OpenWrt Forum Archive

Topic: dnsmasq as a selctor for upstream servers

The content of this topic has been archived on 1 Feb 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi !

I'm connected to the internet but i also have serveral subnets with own domain names...
I also want do have only one dns in my network (DNS for these othernets are done in another net)
So i get my DNS from my ISP, that means on the kamikaze box i'm not able to resolve internel hostnames at all.
Is it possible to configure dnsmasq that way, that in common it uses IPS dns and for domain xxx.net and zzz.net it uses an internal DNS server ?


Ciao Gerd

Is it possible to configure dnsmasq that way, that in common it uses IPS dns and for domain xxx.net and zzz.net it uses an internal DNS server ?

Yes, check out the -S option in the dnsmasq man page-

-S, --local, --server=[/[<domain>]/[domain/]][<ipaddr>[#<port>][@<source-ip>|<interface>[#<port>]]
    Specify IP address of upstream servers directly. Setting this flag does not suppress reading of /etc/resolv.conf, use -R to do that. If one or more optional domains are given, that server is used only for those domains and they are queried only using the specified server. This is intended for private nameservers: if you have a nameserver on your network which deals with names of the form xxx.internal.thekelleys.org.uk at 192.168.1.1 then giving the flag -S /internal.thekelleys.org.uk/192.168.1.1 will send all queries for internal machines to that nameserver, everything else will go to the servers in /etc/resolv.conf. An empty domain specification, // has the special meaning of "unqualified names only" ie names without any dots in them. A non-standard port may be specified as part of the IP address using a # character. More than one -S flag is allowed, with repeated domain or ipaddr parts as required.

    Also permitted is a -S flag which gives a domain but no IP address; this tells dnsmasq that a domain is local and it may answer queries from /etc/hosts or DHCP but should never forward queries on that domain to any upstream servers. local is a synonym for server to make configuration files clearer in this case.

Hope this helps,
Charlie

Hi !

THNX this works but now i have only the lan dns in my /etc/resolv.conf instead of DNS supplied via dhcp from my ISP.
(after reboot)
after restart of dnsmasq i have 5 !!! (3 from ISP 1 from LAN entry in /etc/config/network and 1 127.0.0.1)
and courious is that i can resolve everything with these entries....
nameserver 127.0.0.1
search hoerst.net gf.local

internal external and names w/o domainname...

ciao gerd

(Last edited by gerd on 27 May 2008, 22:33)

The discussion might have continued from here.