Hello everybody,

I added some local static hosts to /etc/hosts, so they can be resolved by any lan client.
Unfortunately the DNS resolution acts very weird:

When I "ping maddes"...
* on the router I get the correct IP address
* on a lan client the DNS is not resolved

When I "ping maddes.lan"
* on the router the DNS is not resolved
* on a lan client I get the correct IP address

I expected that both pings would work on the router and on the clients.

I checked the dnsmasq information in the OpenWRT documentation and checked the forum, but everything seems to be like the standard setup and therefore should work (expand-hosts is enabled in dnsmasq.conf).

Can anybody give me a clue what is missing/wrong?
My configuration setup is following.

Thanks in advance
Maddes

OpenWrt version:
X-Wrt White Russian RC9 (r2761)
with dnsmasq 2.35-1

NVRAM:

# nvram show | grep dhcp
dhcp_domain=lan
dhcp_lease=0
dhcp_num=50
dhcp_start=100
dhcp_wins=wan
lan_dhcp=0
lan_dhcp_enabled=1
lan_dhcp_lease=720m
lan_dhcp_num=50
lan_dhcp_start=100
wan_dhcp_lease=0
wan_dhcp_num=50
wan_dhcp_start=100
wifi_dhcp_lease=0
wifi_dhcp_num=50
wifi_dhcp_start=100

# nvram show | grep dns
wan_dns=
wan_get_dns=195.50.140.114 195.50.140.252

/etc/hosts:

127.0.0.1 localhost OpenWrt
10.0.0.254 gateway
10.0.0.1 maddes

/etc/dnsmasq.conf: (unmodified)

# filter what we send upstream
domain-needed
bogus-priv
filterwin2k
localise-queries

# allow /etc/hosts and dhcp lookups via *.lan
local=/lan/
domain=lan
expand-hosts
no-negcache
resolv-file=/tmp/resolv.conf.auto

# enable dhcp (start,end,netmask,leasetime)
dhcp-authoritative
#dhcp-range=192.168.1.100,192.168.1.250,255.255.255.0,12h
dhcp-leasefile=/tmp/dhcp.leases

# use /etc/ethers for static hosts; same format as --dhcp-host
# <hwaddr> <ipaddr>
read-ethers

# other useful options:
# default route(s): dhcp-option=3,192.168.1.1,192.168.1.2
#    dns server(s): dhcp-option=6,192.168.1.1,192.168.1.2
dhcp-option=lan,1,255.255.0.0

/etc/init.d/S60dnsmasq: (unmodified)

#!/bin/sh
killall -q dnsmasq
pppoa_ifname="atm0" # hack for ppp over atm, which has no ${proto}_ifname
args2=""

#
# initialize any missing nvram variables and turn on dhcp
#   for LAN by default.
#
if [ -z $(nvram get lan_dhcp_enabled) ]; then
    nvram set lan_dhcp_enabled=1                    
fi    
for ifname in lan wan wifi $(nvram get ifnames); do            
    if [ -z $(nvram get ${ifname}_dhcp_start) ]; then
        # cut is in case someone set a full IP here instead of integer
        nvram set ${ifname}_dhcp_start=$(nvram get dhcp_start | cut -d '.' -f 4)
    fi
    if [ -z $(nvram get ${ifname}_dhcp_num) ]; then
        nvram set ${ifname}_dhcp_num=$(nvram get dhcp_num)
    fi
    if [ -z $(nvram get ${ifname}_dhcp_lease) ]; then
        nvram set ${ifname}_dhcp_lease=$(nvram get dhcp_lease)                
    fi
done    

for ifname in lan wan wifi $(nvram get ifnames); do
    dhcp_enabled=$(nvram get ${ifname}_dhcp_enabled)
    if [ "$dhcp_enabled" = 1 ]; then
        dnsmasq_enabled=1
        
        IFPROTO=$(nvram get ${ifname}_proto)
        IFACE=$(nvram get ${ifname}_ifname)
        IFACES=$(nvram get ${ifname}_ifnames)
        
        ipaddr=$(nvram get ${ifname}_ipaddr)
        netmask=$(nvram get ${ifname}_netmask)
        
        start=$(nvram get ${ifname}_dhcp_start)
        num=$(nvram get ${ifname}_dhcp_num)    
        if [ -f "/bin/ipcalc.sh" ]; then
            eval $(ipcalc.sh $ipaddr $netmask ${start:-100} ${num:-150})
        else
            eval $(ipcalc $ipaddr $netmask ${start:-100} ${num:-150})
        fi
        lease=$(nvram get ${ifname}_dhcp_lease)
    [ "$lease" = "0" ] && {
        lease="12h"
        nvram set "${ifname}_dhcp_lease=12h"
    }
        args2="$args2 -F $ifname,$START,$END,$NETMASK,${lease:-12h}"
    fi
done

if [ "$dnsmasq_enabled" = 1 ]; then   
        cache_size=$(nvram get dhcp_cache_size) #-c
        no_hosts=$(nvram get dhcp_no_hosts) #-h
        no_regcache=$(nvram get dhcp_no_regcache) #-N
        strict_order=$(nvram get dhcp_strict_order) #-o
        port=$(nvram get dhcp_port) #-p
        log_queries=$(nvram get dhcp_log_queries) #-q
        no_resolv=$(nvram get dhcp_no_resolv) #-R
        domain=$(nvram get dhcp_domain) #-s
        dhcp_lease_max=$(nvram get dhcp_lease_max) #-X
        read_ethers=$(nvram get dhcp_read_ethers) #-Z
        
        args="-l /tmp/dhcp.leases -K $args2" # ${wanif:+-I ${wanif}}"
        args="$args ${cache_size:+-c ${cache_size}} ${port:+-p ${port}} ${dhcp_lease_max:+-X ${dhcp_lease_max}}"
        args="$args ${domain:+-s ${domain}} ${read_ethers:+-Z } ${no_resolv:+-R} ${log_queries:+-q} ${strict_order:+-o} ${no_regcache:+-N}"
        args="$args ${no_hosts:+-h}"
        dnsmasq ${args}
fi

(Last edited by maddes.b on 20 May 2007, 11:25)