Comment 36 for bug 1418921

Revision history for this message
Alexei Sheplyakov (asheplyakov) wrote :

> fix dnsmasq hashing algorithm, so the bug with the same hash for different MACs will be fixed.

Assigning IPv4 addresses in a stateless manner (i.e. based on the client MAC address only) is impossible.

Proof:
Assume the IP address allocated for a given client does not depend on IPs of other nodes.
Thus all 253 possible addresses (of a /24 subnet) are equally likely.
Then the probability of there not being any two clients having the same IP is

p_unique = (1 - 1/253)*(1 - 2/253)*...*(1 - (N-1)/253)

where N is a total number of clients.

Hence the probability of collision (that is, assigning the same IP to two or more clients) is

p_coll = 1 - p_unique

Note that p_coll = 54% for N = 20, and p_coll = 95% for N = 39.

Basically this means that the IP computed from the client MAC only most likely collides with the IP allocated for another client.
Therefore any correct algorithm is stateful, so the IP leased to a given client can not be stable (it depends on IPs of other clients, on the order in which clients ask for an IP, etc).