Dnsmasq complains about bad dhcp-range once reboot

I am setting up openwrt in a VM. I upload the image, boot the vm, edit /etc/config/network, restart network and everything is fine, until it reboots when dnsmasq fails to start

Sun Aug  6 20:20:46 2023 daemon.crit dnsmasq[1]: bad dhcp-range at line 32 of /var/etc/dnsmasq.conf.cfg01411c
Sun Aug  6 20:20:46 2023 daemon.crit dnsmasq[1]: FAILED to start up

The line being referred to is


which wasn't there before the reboot.
/etc/config/dhcp has the following content:

config dnsmasq                 
        option domainneeded '1'
        option boguspriv '1'       
        option filterwin2k '0'      
        option localise_queries '1' 
        option rebind_protection '1'
        option rebind_localhost '1'
        option local '/lan/'  
        option domain 'lan'   
        option expandhosts '1' 
        option nonegcache '0'   
        option cachesize '1000' 
        option authoritative '1'           
        option readethers '1'                                  
        option leasefile '/tmp/dhcp.leases'                    
        option resolvfile '/tmp/resolv.conf.d/resolv.conf.auto'
        option nonwildcard '1'      
        option localservice '1'     
        option ednspacket_max '1232'
        option filter_aaaa '0'
        option filter_a '0'
config dhcp 'lan'             
        option interface 'lan'
        option start '100'    
        option limit '150'    
        option leasetime '12h'
        option dhcpv4 'server'
        option dhcpv6 'server'
        option ra 'server'            
        option ra_slaac '1'           
        list ra_flags 'managed-config'
        list ra_flags 'other-config'
config dhcp 'wan'             
        option interface 'wan'
        option ignore '1'
config odhcpd 'odhcpd'                      
        option maindhcp '0'                          
        option leasefile '/tmp/hosts/odhcpd'         
        option leasetrigger '/usr/sbin/odhcpd-update'

which I think should translate to something like dhcp-range=set:lan,,,12h. Pretty much all default values. I don't understand why this simple configuration is parsed as dhcp-range=set:lan,19,,,12h.

I am not sure if this is needed, but /etc/config/network has the following content:

config interface 'loopback'
        option device 'lo'
        option proto 'static'
        option ipaddr ''
        option netmask ''

config globals 'globals'
        option ula_prefix 'fdfa:ccdc:1ef5::/48'

config device
        option name 'br-lan'
        option type 'bridge'
        list ports 'eth1'

config interface 'lan'
        option device 'br-lan'
        option proto 'static'
        option ipaddr ''
        option netmask ''
        option ip6assign '60'

config interface 'wan'
        option device 'eth0'
        option proto 'dhcp'

wan connects to my modem, lan connects to a virtual bridge on the host machine and then connects my PC and a wireless router configured as an AP only.

Sounds like it’s related to ipcalc.sh issues, but your config seems fine at first glance. What version are you running?

1 Like

I do see service dnsmasq restart/reload complains about ipcalc.sh not being found although it is in the path at /bin/ipcalc.sh. I am using the latest snapshot of openwrt-23.05. Am I supposed to use a different version? This is my first time compiling and using openwrt.

command -v awk

ipcalc.sh expects /usr/bin/awk


No, I don't have awk. I will try to manually set the DNS server to something else than first and install awk to see if that helps.

OK. I just installed gawk and link it to /usr/bin/awk. Now when I restart network, it does create a different dnsmasq config


which seems correct.
When I restart dnsmasq, I see

udhcpc: started, v1.36.1
udhcpc: broadcasting discover
udhcpc: no lease, failing

I am not sure what is failing, but the DNS server is up and I can see DHCP clients in LuCI. Let me reboot to see if everything works out.

Everything is working after reboot. Thank you @dave14305 for the help.

1 Like

The startup script checks for any other DHCP Server on the LAN first. That check “fails” which is good. :grinning:

Although your problem is solved, this has got me puzzled, awk should be there by default as a busybox app. Since this is part of all standard installs, I'm wondering why it was missing.

$ command -v awk

$ ll /usr/bin/awk
lrwxrwxrwx 1  root  root  17 Jul 30 17:15 /usr/bin/awk -> ../../bin/busybox*

Do you know of anything that could have removed it?

1 Like

I compiled from source and in menuconfig, I remember awk is not included by default in busybox. I updated my config so awk is compiled with busybox the next time, but I haven't tested it out.

1 Like

Awk has been enabled by default in OpenWrt busybox at least since May 2014.

If that is not true for you, you may have removed the OpenWrt defaults from busybox or done something similar. You may have also other expected features missing.

1 Like

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