Discussion:
[Dnsmasq-discuss] Large number of clients connecting simultaneously
Daniel Miess
2018-04-23 17:24:32 UTC
Permalink
Hello,

I am currently making use of dnsmasq in an embedded Linux environment which supports Wi-Fi clients. One of the requirements for this device is that it is able to support 120 simultaneous Wi-Fi connections. In the past I was using dnsmasq version 2.76. I would run a test where all 120 clients would request connections in a very short time span and dnsmasq was able to assign an IP address to each client in about 1 minute. For security reasons I later had to update to version 2.78 of dnsmasq. I now find that it takes far longer to connect these 120 Wi-Fi clients. What used to take 1 minute now takes 6 or more minutes. I've done a bit of digging in the code and the behavior observed seems to be related to the do_icmp_ping function and the integer max defined in this function. It gets set to six and so I observe that 6 clients can be assigned IP addresses right away. After that all other clients will have their DHCPDISCOVERs ignored with a log message of "No addresses available" printed until 30s has passed and then the next group of 6 will receive their addresses.

Is anyone familiar with this behavior? Is there a known workaround? I have attached the dnsmasq.conf file that I'm using. The Wi-Fi interface is uap0 and has been given the range 100 - 250 so I would expect when I connect 120 clients to never receive a message indicating that there are no remaining addresses.

Thanks,
Daniel Miess
Simon Kelley
2018-04-23 19:17:30 UTC
Permalink
I don't think there's been any changes to this code in the 2.76 - 2.78
timeframe, so I'd be inclined to look elsewhere for this.

The ping function is essentially single-threaded, Before sending a
DHCPOFFER, dnsmasq sends a ping to the address to be offered and waits a
few seconds for a reply. If it doesn't get a reply then the OFFER is
sent. During the "wait a few seconds" time. Dnsmasq doesn't reply to any
DHCP packets - they will be queued by the OS. In most cases, this is
fine, but when you're trying to allocate many DHCP leases at once, it
doesn't work so well. The solution is to turn off the ping-checking with
the --no-ping configuration option.


I notice that you're also using the --dhcp-sequential-ip option. I'd
recommend getting rid of that unless you have a good reason to use it.
Dnsmasq is much more efficient at allocating IP addresses with the
default scheme.


Cheers,

Simon.
Post by Daniel Miess
Hello,
 
I am currently making use of dnsmasq in an embedded Linux environment
which supports Wi-Fi clients. One of the requirements for this device is
that it is able to support 120 simultaneous Wi-Fi connections. In the
past I was using dnsmasq version 2.76. I would run a test where all 120
clients would request connections in a very short time span and dnsmasq
was able to assign an IP address to each client in about 1 minute. For
security reasons I later had to update to version 2.78 of dnsmasq. I now
find that it takes far longer to connect these 120 Wi-Fi clients. What
used to take 1 minute now takes 6 or more minutes. I’ve done a bit of
digging in the code and the behavior observed seems to be related to the
do_icmp_ping function and the integer max defined in this function. It
gets set to six and so I observe that 6 clients can be assigned IP
addresses right away. After that all other clients will have their
DHCPDISCOVERs ignored with a log message of “No addresses available”
printed until 30s has passed and then the next group of 6 will receive
their addresses.
 
Is anyone familiar with this behavior? Is there a known workaround? I
have attached the dnsmasq.conf file that I’m using. The Wi-Fi interface
is uap0 and has been given the range 100 – 250 so I would expect when I
connect 120 clients to never receive a message indicating that there are
no remaining addresses.
 
Thanks,
Daniel Miess
_______________________________________________
Dnsmasq-discuss mailing list
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
Loading...