Modify

Opened 8 years ago

Closed 8 years ago

Last modified 4 years ago

#6459 closed defect (fixed)

dns doesn't work without /etc/hosts

Reported by: Michael Ploujnikov <ploujj@…> Owned by: developers
Priority: normal Milestone: Barrier Breaker 14.07
Component: packages Version: Trunk
Keywords: Cc:

Description

From what I understand about http://wiki.openwrt.org/doc/uci/dhcp and what I'm told by other people, I should be able to configure static dhcp leases and hostname mappings in /etc/config/dhcp alone. I tried the following configuration, which does not seem to work:

#

 cat /etc/config/dhcp 
config dnsmasq
	option domainneeded	1
	option boguspriv	1
	option filterwin2k	'0'  #enable for dial on demand
	option localise_queries	1
	option local	'/lan/'
	option domain	'lan'
	option expandhosts	1
	option nonegcache	0
	option authoritative	1
	option readethers	0
	option nohosts		1
	option leasefile	'/tmp/dhcp.leases'
	option resolvfile	'/tmp/resolv.conf.auto'

config dhcp lan
	option interface	lan
	option start 	100
	option limit	150
	option leasetime	12h

config dhcp wan
	option interface	wan
	option ignore	1

config dhcp public
	option interface	public
	option start	100
	option limit	150
	option leasetime	12h

config host
	option name	yeti
	option mac	00:22:15:64:A0:3D
	option ip	10.2.2.10

This only works as far as assigning 10.2.2.10 to the right machine.

Jan  6 18:59:03 OpenWrt daemon.info dnsmasq-dhcp[1978]: DHCPACK(br-lan) 10.2.2.10 00:22:15:64:a0:3d

However, ping by hostname fails:

root@OpenWrt:~# ping yeti
ping: bad address 'yeti'

Trying to resolve the hostname from a client machines also fails:

[plouj@durandal ~]$ dig yeti

; <<>> DiG 9.6.1-P2-RedHat-9.6.1-13.P2.fc12 <<>> yeti
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 56932
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;yeti.				IN	A

;; Query time: 3 msec
;; SERVER: 10.2.2.2#53(10.2.2.2)
;; WHEN: Wed Jan  6 19:47:09 2010
;; MSG SIZE  rcvd: 22

If I add

10.2.2.10 yeti

to /etc/hosts on the router, the problem goes away. However, I do not like this alternative because it means keeping the mapping between MACs IPs and hostnames in different places.

I'm experiencing this with SVN r19014 and dnsmasq 2.51-2.

Attachments (0)

Change History (4)

comment:1 Changed 8 years ago by MichaelPloujnikov <ploujj@…>

I modified /etc/init.d/dnsmasq to enable shell command echoing

set -x                                
        /usr/sbin/dnsmasq $args && {
                rm -f /tmp/resolv.conf
                DNS_SERVERS="$DNS_SERVERS 127.0.0.1"
                for DNS_SERVER in $DNS_SERVERS ; do
                        echo "nameserver $DNS_SERVER" >> /tmp/resolv.conf
                done
set +x

and I saw this:

OpenWrt:~# /etc/init.d/dnsmasq restart
+ /usr/sbin/dnsmasq -K -D -h -y -b -E -s lan -S /lan/ -l /tmp/dhcp.leases -r /tmp/resolv.conf.auto --dhcp-host=00:22:15:64:A0:3D,net:yeti,10.2.2.10-2 ppp0
+ rm -f /tmp/resolv.conf
+ DNS_SERVERS= 127.0.0.1
+ echo nameserver 127.0.0.1
+ set +x

so this seems like a dnsmasq bug or my mis-interpretation of how it's supposed to work.

comment:2 Changed 8 years ago by MichaelPloujnikov <ploujj@…>

Oops. I made a typo when 'censoring' the output and removed an extra space. The dnsmasq command should be:

+ /usr/sbin/dnsmasq -K -D -h -y -b -E -s lan -S /lan/ -l /tmp/dhcp.leases -r /tmp/resolv.conf.auto --dhcp-host=00:22:15:64:A0:3D,net:yeti,10.2.2.10 -2 ppp0

Note the space before "-2".

comment:3 Changed 8 years ago by jow

  • Resolution set to fixed
  • Status changed from new to closed

I believe this issue is fixed with r19069. Please open a new ticket and refer to this one if you still see the issue.

comment:4 Changed 4 years ago by jow

  • Milestone changed from Attitude Adjustment 12.09 to Barrier Breaker 14.07

Milestone Attitude Adjustment 12.09 deleted

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.