DNSmasq & STATIC leases LOCK the router (AC66U)

Post new topic   Reply to topic    DD-WRT Forum Forum Index -> Broadcom SoC based Hardware
Author Message
Giuliano1969
DD-WRT Novice


Joined: 16 Oct 2009
Posts: 32

PostPosted: Mon Apr 04, 2016 16:08    Post subject: DNSmasq & STATIC leases LOCK the router (AC66U) Reply with quote
I suppose I found a problem in many ddwrt version with DNSmasq acting as local DHCP with STATIC leases
(version tested 26339, 28598, 28647, 29346 – router Asus AC66U )


All tests performed, have started with installing the 26339, and then flashing the other new fw (just one run for 26339 test itself)

Everything works after installation, and first configuration (DNS, Gateway, ntp, local ip, netmask, wireless ssid & password,…)

HOW to reproduce the problem
Just insert some static leasse (8, save & reboot:
1)The router dhcp works no more, neither gives my laptop a IP, nor i can connect to the router or internet
2)If I give a manual ip to my laptop, I can connect to the router and see in Status->Sysinfo that the DHCP i enabled but stopped (!!). I can connect to the router, but not “exit” to the internet. The wireless network stop working (!!)

How to try to FIX the problem:
Go to Setup->Basic->Use DNSMasq for DHCP (), disable and save it and restart it,
A) everything works again (wireless reappears, static lease, dhcp, internet ...)
B) Strangely in Status->Sysinfo DHCP is said to be running (server udcpd should run)
BUT in Status→LAN , the DHCP Status is “DHCP ServerDisabled”

I can reproduce this error with all tested fw: ( 26339, 28598, 28647, 29346).
It seems that I can make DHCP work well with only udhcpd, but not together with DNSmasq…..


Can I provide some file or command output, to check where the problem could be in the router ?

I attach two screen-shots of the working setup WITHOUT DNSmasq running.


In case this is useful, here's the contents of my config files
Code:
/tmp/dnsmasq.conf :
interface=br0
resolv-file=/tmp/resolv.dnsmasq
all-servers
strict-order
domain=glan
stop-dns-rebind


and /tmp/udhcpd.conf
Code:
pidfile /var/run/udhcpd.pid
start 192.168.0.140
end 192.168.0.189
max_leases 69
interface br0
remaining yes
auto_time 30
lease_file /tmp/udhcpd.leases
statics_file /tmp/udhcpd.statics
option subnet 255.255.255.0
option router 192.168.0.1
option lease 86400
option dns 208.67.222.222 208.67.220.220 192.168.1.1
option domain glan
[img][/img]


ddwrt-29346-c.png
 Description:
 Filesize:  172.89 KB
 Viewed:  17919 Time(s)

ddwrt-29346-c.png



ddwrt29346-a.png
 Description:
 Filesize:  59.25 KB
 Viewed:  17919 Time(s)

ddwrt29346-a.png


Sponsor
MelectroK
DD-WRT Novice


Joined: 22 Jul 2015
Posts: 27

PostPosted: Mon Apr 04, 2016 17:32    Post subject: Reply with quote
I think you need to have your first DNS set to your local router IP in order to use static IP this way. Your DNS addresses are pointed outside your local lan. I have done the same thing in build 29218 but my local gateway ip is also in the first DNS. But I am not positive it wont work that way, you may just loose the ablility to use the DNS name lookup.

I also have my "Use DNSmasq as DHCP" button checked. And I have my "DHCP Server" under Services set to Lan & Wlan, with a "Local Domain" entered
Giuliano1969
DD-WRT Novice


Joined: 16 Oct 2009
Posts: 32

PostPosted: Mon Apr 04, 2016 18:57    Post subject: Reply with quote
Thanks Melectrok for your kind reply.

Following ddwrt wiki https://www.dd-wrt.com/wiki/index.php/DNSMasq_as_DHCP_server, the ddwrt may use TWO different dchp server: the udhcpd (part of busybox) and DNSMasq.
The two programs use two different config file.
From what I understand. The udhcpd could be stopped and let dnsqmas do also the dhcp job.


The data that you can input into Newtork-Setup→NetworkAddressServerSettings, are the one you find into the /tmp/udhcpd.conf , and are the one you could find in your laptop, after it will receive the informations from the DHCP server.

About the idea of inserting as first DNS the same router, the idea may seems not correct:
the router should have a bind server inside or use the same external DNS server above…
Additional DNS addresses could be submitted as https://support.opendns.com/entries/26539130-Additional-3rd-and-4th-OpenDNS-Addresses

Anyway the problem is not about DNS resolving domains, but DHCP assigning ip… the reported message “DHCP enabled – stopped” shows that something in the config data or sourcecode is not working…


Could be interesting if someone with AC66U could test the same data and behaviour...
Giuliano1969
DD-WRT Novice


Joined: 16 Oct 2009
Posts: 32

PostPosted: Mon Apr 04, 2016 19:14    Post subject: Reply with quote
Even more,
I kindly ask Brian if may be changed the behaviour of the menu:
Whend DNSmasq i enabled, the Status->LAN->Dynamic Host Configuration Protocol shows that DHCP is enabled and shows also that the server is DNSmasq.

Instead when DNSmasq is disabled (BUT udhcpd should work instead), the same above menu says the DHCP server is disabled.. but it's WRONG... simply the dhcp server working is the "old" udhcpd....



ddwrt-dnsmasqenabled.png
 Description:
 Filesize:  26.88 KB
 Viewed:  17878 Time(s)

ddwrt-dnsmasqenabled.png



ddwrt_dnsmasqenabled.png
 Description:
 Filesize:  67.05 KB
 Viewed:  17878 Time(s)

ddwrt_dnsmasqenabled.png



ddwrt_dnsmas-Disabled.png
 Description:
 Filesize:  12.38 KB
 Viewed:  17878 Time(s)

ddwrt_dnsmas-Disabled.png


JAMESMTL
DD-WRT Guru


Joined: 13 Mar 2014
Posts: 856
Location: Montreal, QC

PostPosted: Mon Apr 04, 2016 20:59    Post subject: Reply with quote
Leave gateway address in router ip section blank or the address of the router 192.168.0.1

From the sounds of it there is an error in the dnsmasq config file that is causing dnsmasq to fail to start. this could be as simple as a typo in your address reservations.

If the problem is related to the address reservations, you could try removing all the address reservations and then add them in 1 by 1 until dnsmasq stops working.

Otherwise ,enable syslog and configure router to use dnsmasq. Manually assign an IP to your laptop then connect to the router via ssh or telnet and run the following from CLI

ps
grep dnsmasq /var/log/messages
cat /tmp/dnsmasq.conf

Now obfuscating MACs and host names is only going to hide problems from people trying to help you and does not provide any additional security.

_________________
IPv6 Ready - HE IPv6 Tunnel
http://test-ipv6.com (10/10)
http://ipv6-test.com (20/20)
http://test-ipv6.netiter.dk (20/20)

Giuliano1969
DD-WRT Novice


Joined: 16 Oct 2009
Posts: 32

PostPosted: Wed Apr 06, 2016 13:29    Post subject: Reply with quote
Dear JAMESMTL thanks for your kind reply.
Analyzing the traffic data with wireshark, it showed that having set the gateway address to the isp router, it resulted of having the majority of the dns request to be forwarded directly to the gateway INSTEAD to the Opendns server. Even if primary and secondary dns set to opendns.

Setting the gateway for the lan to the ddwrt router address itself, resulted in having ALL the dns query been correctly forwarded to OpenDNS

I found the static lease be saved in : udhcpd.statics and udhcpd.leases ; both are udchp server files, not dnsmasq files

the udhcpd.leases seems not to be a txt file.

The hostnames text was allowed to be input in the ddwrt by the web form... even if it has "-","(", ")", "/" chars into ...and udhcpd DOES work with it...
If the were TLD names, some chars are not allowed...
https://en.wikipedia.org/wiki/Hostname#Restrictions_on_valid_host_names

If this could be the problem with DNSmasq (not with udhcpd,that IS working with this config) I could change the hostnames and have your test done....


scp root@192.168.0.1:/tmp/udhcpd.statics udhcpd.statics
Code:

192.168.0.1 F0:79:59:CE:3C:90 DD-WRT-3
192.168.0.5 2c:76:8a:04:c4:d5 CM1415fnw
192.168.0.6 00:15:99:48:8c:4a CLP620ND
192.168.0.7 2c:76:8a:04:c4:d5 Philips-32pfl8404
192.168.0.8 1c:5a:3e:e3:c6:0a BD-E-8900/EN
192.168.0.64 60:02:92:29:ca:a5 Hotbird13-wired
192.168.0.65 00:1e:58:ff:e9:82 Saturn
192.168.0.66 00:1c:f0:d5:a3:ba Mercury
192.168.0.67 00:25:22:ed:a5:08 Venus(GG)
192.168.0.68 e4:1f:13:95:8e:c3 Andromeda(Ga)
192.168.0.69 10:dd:b1:de:16:24 Melograno
192.168.0.70 b8:27:eb:cf:53:8a Raspberry1
192.168.0.128 08:ee:8b:59:ce:71 GalaxyTab4-Gabriele
192.168.0.129 44:80:eb:82:f1:e6 MotorolaG2014-Gabriele
192.168.0.130 80:6c:1b:c5:ca:cd MotorolaG2014-Giulia
192.168.0.131 5c:f8:a1:c6:a1:b2 Note2-Giuliano
192.168.0.132 20:02:af:ab:46:d0 Note2-Giuliana
192.168.0.134 7c:1e:52:7f:6c:82 Xbox360-wifi
192.168.0.135 08:3e:8e:ee:8e:c9 Hotbird13-wifi
192.168.0.136 5c:ac:4c:77:89:91 Apollo11-wifi
192.168.0.137 50:01:bb:45:a2:55 GalaxyTab2-Mamma
192.168.0.138 74:75:48:ff:f6:a9 KindleMamma



Here the dnsmasq.conf file
scp root@192.168.0.1:/tmp/dnsmasq.conf dnsmasq.conf
Code:
interface=br0
resolv-file=/tmp/resolv.dnsmasq
all-servers
strict-order
domain=glan
stop-dns-rebind
JAMESMTL
DD-WRT Guru


Joined: 13 Mar 2014
Posts: 856
Location: Montreal, QC

PostPosted: Wed Apr 06, 2016 18:40    Post subject: Reply with quote
yes you have invalid hostnames causing dnsmasq to choke

invalid chars: ()/

valid: All alpha/numeric + dash + underscore

_________________
IPv6 Ready - HE IPv6 Tunnel
http://test-ipv6.com (10/10)
http://ipv6-test.com (20/20)
http://test-ipv6.netiter.dk (20/20)

Giuliano1969
DD-WRT Novice


Joined: 16 Oct 2009
Posts: 32

PostPosted: Wed Apr 06, 2016 19:35    Post subject: Reply with quote
Thanks for your kind answer.
I could try to put all the information together:

Static leases in ddwrt are stored in /tmp/udhcpd.statics
Udhpcd server, can assign dynamic ip and static ip for the network, without interacting with DNSmasq server.
Considering the RFC https://tools.ietf.org/html/rfc2132 , the dhcp protocol will never deal with the hostnames contained in the /tmp/udhcpd.statics : hostnames are informations not transfered not assigned by such protocol.
So this could explain why the invalid chars have no effect with it: udhcpd simply doesn’t use them.

When the DNSmasq is requested to act ALSO as a dhcp server, it will use such information also for resolving local hostname address; but the typo error in /tmp/udhcpd.statics will make it fail.

I changed the hostnames removing the invalid chars, and NOW it WORKS !

I would suggest some POSSIBLE TWO IMPROVEMENTS in the following tabs:
Service→Services→ DHCP server ->Static_lease
Status → LAN→ DHCP

1 IMPROVEMENT
In Service→Services→ DHCP server →Static_lease the hostname filed could filter the invalid chars before to accept them (isalpa() || isnum() || ‘-’)

2 IMPROVEMENT/ERROR
In Status → LAN→ DHCP → DHCP Status , the mask should give information on which DHCP server is running.
If I enable DNSmasq as dhcp server, the mask update specifing that: “ DHCP Server =Enabled
DHCP Daemon=DNSMasq”
When using ONLY udhcp (not DNSmasq for dhcp), the information is WRONG because it says the DHCP is disabled when clearly it is not... udhcp is running (it can be seen in System → Sysinfo); what is NOT running as dhcp server is DNSmasq.
For the same reason it will not show the active dhcp clients...

Even more strangely (!!), to let the mask display the “ DHCP Server =Enabled DHCP Daemon=DNSMasq” it is not necessary to clik on “apply settings”: it is enough to set the DNSmasq as dhcp serve, Save it, and voilà…. The Status → LAN→ DHCP → DHCP Status start showing that the DNSmasq is running (without applying….)

thanks JAMESSTL for your help
JAMESMTL
DD-WRT Guru


Joined: 13 Mar 2014
Posts: 856
Location: Montreal, QC

PostPosted: Wed Apr 06, 2016 20:19    Post subject: Reply with quote
Good to hear you got it working
_________________
IPv6 Ready - HE IPv6 Tunnel
http://test-ipv6.com (10/10)
http://ipv6-test.com (20/20)
http://test-ipv6.netiter.dk (20/20)

b-man
DD-WRT User


Joined: 09 May 2010
Posts: 101

PostPosted: Mon Sep 05, 2016 11:02    Post subject: i have the same issue Reply with quote
i have the same issue


Router: Asus RT-AC87U
Firmware: DD-WRT v3.0-r30534 std (09/01/16)
Previous: Merlin
Kernel: dont know
Reset: multiple with multiple erase nvrams
Errors/Issues:

when setting static leases in the services tab it seems to break DHCP and nothing is able to connect
phones just get stuck on obtaining ip address

(i put about 30 blank ones in and then fill out what i want and label all the others with a fake mac and empty status for future proofing)

yet when i remove all static leases and apply settings. instantly my phone connects

as far as im aware i have no invalid Chars

i thought it was some sort of limit causing it as i done 5 then saved and it worked but by the time i had done the rest and rebooted it didnt.
i had to remove every last one before it started working again


edit:
ok i noticed after looking at all the static Ip's i had put in there i have a " RaspberryPi-B+ "
im assuming the " + " is whats breaking it?

all my blanks are " --EMPTY-- " reading that link it says
Quote:
The original specification of hostnames in RFC 952, mandated that labels could not start with a digit or with a hyphen, and must not end with a hyphen. However, a subsequent specification (RFC 1123) permitted hostname labels to start with digits. No other symbols, punctuation characters, or white space are permitted.


but they seemed to work back in the day.
i will test and remove them too
freemyrouter
DD-WRT Novice


Joined: 08 Sep 2017
Posts: 5

PostPosted: Fri Sep 08, 2017 3:46    Post subject: Reply with quote
This!

Thank you! This was driving me nuts Crying or Very sad
bigjohn
DD-WRT User


Joined: 08 Jun 2006
Posts: 123

PostPosted: Thu Nov 02, 2017 0:54    Post subject: Reply with quote
freemyrouter wrote:
This!

Thank you! This was driving me nuts Crying or Very sad


I have this problem exactly.
no invalid characters in the hostnames.

But if I enable 'dnsmasq for dhcp' check box, the router status shows "DHCP enabled-stopped".

How was this finally resolved? I'm not clear, I don't think...
(linux noob...)

_________________
support DD-WRT and get great hosting!
mrjcd
DD-WRT Guru


Joined: 31 Jan 2015
Posts: 5359
Location: Texas

PostPosted: Thu Nov 02, 2017 11:33    Post subject: Reply with quote
bigjohn wrote:
freemyrouter wrote:
This!

Thank you! This was driving me nuts Crying or Very sad


I have this problem exactly.
no invalid characters in the hostnames.

But if I enable 'dnsmasq for dhcp' check box, the router status shows "DHCP enabled-stopped".

How was this finally resolved? I'm not clear, I don't think...
(linux noob...)

Are you sure.... about 98% chance you have an invalid character somewhere.
Seen this several times ....in a string of 50 staic leases it only takes the mistake of an o for 0 to break the whole thing or an l in place of a 1.
Remember MACs are hex vaules
bigjohn
DD-WRT User


Joined: 08 Jun 2006
Posts: 123

PostPosted: Thu Nov 02, 2017 13:32    Post subject: Reply with quote
Thanks for replying
one of the responders here said:
valid: All alpha/numeric + dash + underscore

So I have removed all spaces (though space was fine in tomato, and in the netgear native firmware...)

oh damn. so I just went and looked again... and son-of-a-goat, there was a space. I guess I didn't APPLY after the last edits I did.

I will reboot the router after work and reply here with a status update.

_________________
support DD-WRT and get great hosting!
bigjohn
DD-WRT User


Joined: 08 Jun 2006
Posts: 123

PostPosted: Mon Nov 06, 2017 13:34    Post subject: Reply with quote
well well.
Wrapping this up.
The router has been running just fine. Thanks all for your help.

_________________
support DD-WRT and get great hosting!
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Forum Index -> Broadcom SoC based Hardware All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum