3

ssh'ing to my openwrt (ver. 10.03.1-RC6) shows that there is something wrong with its dns server:

root@OpenWrt:~# nslookup starkill
Server:    127.0.0.1
Address 1: 127.0.0.1 localhost.

nslookup: can't resolve 'starkill': Name or service not known

whereas,

root@OpenWrt:~# nslookup starkill.skails.home
Server:    127.0.0.1
Address 1: 127.0.0.1 localhost.

Name:      starkill.skails.home
Address 1: 192.168.112.138 starkill.skails.home

As you can see the local dns server (dnsmasq) of openwrt cannot resolve non-FQDN hostnames. Appending the domain of my intranet resolves this issue, but does not work for me:

Since I have a dns server running in my intranet, I would like to at least have openwrt's dnsmasq consult my primary dns server.

so I checked the web-config over and over but couldn't figure out what is wrong or missing. Then I checked the file /etc/config/network , along with the manual.

the file initially looked like:

[...]
config 'interface' 'lan'
        option 'type' 'bridge'
        option 'ifname' 'eth0.0'
        option '_orig_ifname' 'eth0.0 wl0'
        option '_orig_bridge' 'true'
        option 'proto' 'static'
        option 'ipaddr' '192.168.112.253'
        option 'netmask' '255.255.255.0'
        option 'gateway' '192.168.112.112'
        option 'broadcast' '192.168.112.255'
        option 'stp' '1'
        list 'dns' '192.168.112.112'
[...]

there is a "list dns ", inserted by the web-config which does not look like the usual "option " that I would expect to see. so i tried that

    option 'dns' '192.168.112.112'

I also tried the "dns-search" option , in every way possible

   option 'dns-search' 'skails.home'
   list 'dns-search' 'skails.home.'

everytime I restarted the network with /etc/init.d/network reload . the dns-search clauses could not be parsed so I had to remove them.

you'll notice I show you the "lan" interface entry above. The reason is that I use my WRT54G as an access point only. I do not utilize the WAN interface, but rather one of the 4 LAN ethernet interfaces (which is connected to the rest of my intranet, and where internet gateway lies) and basically use the antennas of my unit to provide access to intranet and internet for wifi devices.

anyhow, trying to alter /etc/config/network did not yield the expected result and I still cannot resolve non-FQDN hostnames.

What is more, I cannot even do the resolving when I explicitly suggest a nameserver, either through /etc/resolv.conf , or directly with nslookup:

root@OpenWrt:~# nslookup starkill 192.168.112.112
Server:    192.168.112.112
Address 1: 192.168.112.112 stargaze.skails.home

nslookup: can't resolve 'starkill': Name or service not known

At this point I am lost. what am I missing here?

2 Answers 2

1

dnsmasq is somewhat unreliably at the moment on my barrier breaker, which results in

nslookup: can't resolve 'starkill': Name or service not known

here as well, even if the name can normally be resolved without problems.

first try a

killall -HUP dnsmasq

or even a restart if you like to be sure dnsmasq actually serves requests as it should.

second, there is an option to automatically complete FQDNs in dnsmasq. i have this working here with the following config (/etc/config/dhcp):

config dnsmasq
    option domainneeded '1'
    option boguspriv '1'
    option localise_queries '1'
    option rebind_protection '1'
    option rebind_localhost '1'
    option local '/lan/'
    option domain 'lan'
    option expandhosts '1'
    option readethers '1'
    option leasefile '/tmp/dhcp.leases'
    option resolvfile '/tmp/resolv.conf.auto'
    option filterwin2k '1'
    list addnhosts '/var/adblock/block.hosts'

expandhosts is for /etc/hosts only, so mostly not appliable to your setup, but i think that local AND domain should help you.

my /etc/config/network has

option dns '192.168.200.1'

i don't know right now if network reload really also reloads dnsmasq in such a way that it rebinds dhcp leases which you would have to trigger on client side otherwise for the directive to take effect.

have you tried tcpdump'ing on your DNS server when querying it directly with nslookup? does the request ever reach it? this would be a first pointer to make sure the problem is indeed at the openwrt box...

if you find a way for making dnsmasq consistently serve request, let me know, this really making things here pretty unstable.

i don't know it you can edit /etc/dnsmasq.conf at all, but there are plenty of options you could play with. i used dnsmasq on full linux boxen a few times and have always been able to configure it to suit my needs but i think it's a little different on openwrt as it seems..

also probably take a look at the respective section (secondary dns) at http://wiki.openwrt.org/doc/howto/dhcp.dnsmasq#add_a_secondary_dns

1

The correct option is with an underscore:

option dns_search 'my.local.domain'
1
  • ah I have removed this openwrt from operation . I wonder if this is an option syntax that was changed at some point.I will however keep it in my for my next openwrt :)
    – nass
    Commented Apr 13, 2020 at 10:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .