I have a version 15.05 OpenWRT router which is a member of a local network. This network has its own DHCP and DNS servers which dnsmasq should automatically use for domain name resolution. However host names for members of the lan are not resolving through dnsmasq.

I tried /etc/init.d/dnsmasq stop which allowed these names to resolve on the router. However this stopped all domain name resolution on my laptop while connected to the router.

I'd like dnsmasq to not filter local domain names from its results, and for it to use the proper DNS servers (I belive it does), or to find a way to live without dnsmasq by passing on upstream DNS server IP addresses to clients of the router. (I would prefer to not hard code DNS server IP addresses so that the router can be used in other environments without reconfiguration.)

I disabled some of the options below because they ensure "... that requests for these local host names (and the reverse lookup) never get forwarded to the upstream DNS servers." [1] However This did not solve my issues with dnsmasq.

root@wrt0:~# cat /etc/config/dhcp

config dnsmasq
        #option domainneeded '1'
        option domainneeded '0'
        #option boguspriv '1'
        option boguspriv '0'
        option filterwin2k '0'
        #option localise_queries '1'
        option localise_queries '0'
        option rebind_protection '1'
        option rebind_localhost '1'
        option local '/lan/'
        option domain 'lan'
        #option expandhosts '1'
        option expandhosts '0'
        option nonegcache '0'
        #option authoritative '1'
        option authoritative '0'
        option readethers '1'
        option leasefile '/tmp/dhcp.leases'
        option resolvfile '/tmp/resolv.conf.auto'
        option localservice '1'


root@wrt0:~# cat /etc/config/network

config interface 'lan'
        option ifname 'eth1'
        option type 'bridge'
        option proto 'static'
        option ipaddr ''
        option netmask ''


root@wrt0:~# cat /etc/resolv.conf 
search lan

root@wrt0:~# cat /tmp/resolv.conf.auto 
# Interface wan
search office.website.org
search website.org

When resolving local names using dnsqmasq, resolution fails:

root@wrt0:~# nslookup abc.office.website.org
Address 1: localhost

nslookup: can't resolve 'abc.office.website.org': Name or service not known

When bypassing dnsmasq, resolution works fine:

root@wrt0:~# nslookup abc.office.website.org
Address 1: resolver.office.website.org

Name:      abc.office.website.org
Address 1: abc.office.website.org

dnsmasq looks up internet-facing servers without a hitch:

root@wrt0:~# nslookup abc.website.org
Address 1: localhost

Name:      abc.website.org
Address 1: 208.xxx.xxx.xxx xyz.website.org

Do you have any ideas about how I may bypass dnsmasq's filtering, or bypass dnsmasq altogether? Thanks! : D


One solution is to disable dnsmasq and change the dhcp 'lan' section of /etc/config/dhcp, although it requires network-specific configuration:

root@wrt0:~# /etc/init.d/dnsmasq stop
root@wrt0:~# /etc/init.d/dnsmasq disable

config dhcp 'lan'
        option interface 'lan'
        option start '100'
        option limit '150'
        option leasetime '12h'
        option dhcpv6 'server'
        option dhcpv4 'server'
        option ra 'server'
        list   dns ''
        list   dns ''
        list   domain 'office.website.org'
        list   domain 'website.org'
        list   domain 'othersite.org'

Another way to achieve similar results is to use dnsmasq and add an option to /etc/dnsmasq.conf:


Hoewver it isn't clear how to set multiple search domains using dnsmasq.

Unfortunately, for both of these methods settings needs to be edited if the router is used on a different network or if the DNS IP address changes, so it is not the perfect answer.


First of all, you should really upgrade to the current (18.X) or last release (17.X.X): https://wiki.openwrt.org/de/doc/howto/generic.sysupgrade

If I understand correctly, the DNS and DHCP server are different devices in your network? If so, the domainneeded should probably be on and you should have the DNS to IP mapping in /etc/hosts. Read the first part of the documentation for further hints.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.