Dnsmasq does not honor `search` option in `/etc/resolv.conf`

Content of /var/etc/dnsmasq.conf.cfg01411c

# auto-generated config file from /etc/config/dhcp
conf-file=/etc/dnsmasq.conf
domain-needed
log-queries=extra
enable-ubus
expand-hosts
bind-dynamic
domain=example.com
server=8.8.8.8
server=8.8.4.4
dhcp-leasefile=/tmp/dhcp.leases
resolv-file=/etc/resolv.conf
stop-dns-rebind
dhcp-broadcast=tag:needs-broadcast
addn-hosts=/tmp/hosts
conf-dir=/tmp/dnsmasq.d
user=dnsmasq
group=dnsmasq


dhcp-ignore-names=tag:dhcp_bogus_hostname
conf-file=/usr/share/dnsmasq/dhcpbogushostname.conf


bogus-priv
conf-file=/usr/share/dnsmasq/rfc6761.conf
no-dhcp-interface=eth0
no-dhcp-interface=eth1

Content of /etc/resolv.conf:

# Interface wan
nameserver 127.0.0.1
search example.com

But when I query like this:

root@OpenWrt:~# nslookup www
Server:         127.0.0.1
Address:        127.0.0.1#53

*** Can't find www: No answer
*** Can't find www: No answer

It does not expand my query with the domain specified with search option in etc/resolv.conf. Did I make any mistake in the configuration or is there a issue with dnsmasq in OpenWRT?

dnsmasq version:

root@OpenWrt:~# dnsmasq -v
Dnsmasq version 2.80  Copyright (c) 2000-2018 Simon Kelley
Compile time options: IPv6 GNU-getopt no-DBus no-i18n no-IDN DHCP no-DHCPv6 no-Lua TFTP no-conntrack no-ipset no-auth no-DNSSEC no-ID loop-detect inotify dumpfile

This software comes with ABSOLUTELY NO WARRANTY.
Dnsmasq is free software, and you are welcome to redistribute it
under the terms of the GNU General Public License, version 2 or 3.

OpenWRT version:

root@OpenWrt:~# cat /etc/os-release
NAME="OpenWrt"
VERSION="19.07.2"
ID="openwrt"
ID_LIKE="lede openwrt"
PRETTY_NAME="OpenWrt 19.07.2"
VERSION_ID="19.07.2"
HOME_URL="https://openwrt.org/"
BUG_URL="https://bugs.openwrt.org/"
SUPPORT_URL="https://forum.openwrt.org/"
BUILD_ID="r10947-65030d81f3"
OPENWRT_BOARD="x86/64"
OPENWRT_ARCH="x86_64"
OPENWRT_TAINTS=""
OPENWRT_DEVICE_MANUFACTURER="OpenWrt"
OPENWRT_DEVICE_MANUFACTURER_URL="https://openwrt.org/"
OPENWRT_DEVICE_PRODUCT="Generic"
OPENWRT_DEVICE_REVISION="v0"
OPENWRT_RELEASE="OpenWrt 19.07.2 r10947-65030d81f3"

The search list isn't used by nslookup. I don't think it should be.

The search list is used with ping works:

# nslookup www.example.com
Server:		127.0.0.1
Address:	127.0.0.1#53

Name:      www.example.com
Address 1: 93.184.216.34
Address 2: 2606:2800:220:1:248:1893:25c8:1946

# ping www.example.com
PING www.example.com (93.184.216.34): 56 data bytes
64 bytes from 93.184.216.34: seq=0 ttl=57 time=108.227 ms
^C
--- www.example.com ping statistics ---
1 packets transmitted, 1 packets received, 0% packet loss
round-trip min/avg/max = 108.227/108.227/108.227 ms

Dnsmasq also shouldn't use the search list itself, but it distributes it to dhcp clients.

2 Likes

I was constantly testing with nslookup because on my ubuntu box nslookup also honors search list. But you are right, it actually works with ping and other queries.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.