[Dnsmasq-discuss] Dynamic-range clients don't get the same IP address when rebooted
Simon Kelley
simon at thekelleys.org.uk
Thu Jun 23 22:47:11 BST 2016
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
On 23/06/16 21:02, John Groves (jgroves) wrote:
> I'm a long-time dnsmasq user, but first-time poster. I can't
> imagine that this hasn't been discussed before, but I wasn't able
> to come up with search terms to find it.
>
> This arises because we are creating and destroying VMs like crazy
> for automated software testing. The VMs are using dynamic-range
> addresses, and every time a VM is rebooted it gets a new address,
> even if there is a valid existing lease. And we see leases for the
> same mac address accumulating in the leases file, like this:
>
> 1466722310 52:54:00:51:e7:ad 10.114.5.186 localhost
> ff:00:51:e7:ad:00:01:00:01:1e:fe:ec:44:52:54:00:51:e7:ad 1466722212
> 52:54:00:51:e7:ad 10.114.5.185 *
> ff:00:51:e7:ad:00:01:00:01:1e:fe:eb:e2:52:54:00:51:e7:ad 1466719093
> 52:54:00:51:e7:ad 10.114.5.184 *
> ff:00:51:e7:ad:00:01:00:01:1e:fe:df:b3:52:54:00:51:e7:ad 1466718818
> 52:54:00:6f:8c:2a 10.114.5.227 *
> ff:00:6f:8c:2a:00:01:00:01:1e:fe:de:9f:52:54:00:6f:8c:2a 1466715993
> 52:54:00:4a:54:e7 10.114.5.179 *
> ff:00:4a:54:e7:00:01:00:01:1e:fe:d3:96:52:54:00:4a:54:e7
>
> Is there a way to coax dnsmasq to give out an address matching the
> still-valid lease, if any?
>
> FYI the VMs are mostly Fedora 2[234] and RHEL7
>
> The changing addresses are a challenge for our test automation...
>
> Thanks, John Groves
If the DHCP provides a client-id, that's used to identify the client
in preference to the MAC address. The client-id is the last field on
each line of the lease-file, and we can see the client-ids for each
lease associated with a single MAC address are different in a couple
of bytes. These bytes are probably generated from the system time.
To fix this, build your VMs to not provide a client-id, or one
completely determined by the MAC address. You can also configure
dnsmasq to ignore the client-id with something like
dhcp-host=52:54:00:*:*:*,id:*
Cheers,
Simon.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)
iQIcBAEBCAAGBQJXbFjfAAoJEBXN2mrhkTWiej4P/20kUt94wBuhowgrxg0VOBrP
PV2uj9XTdpNG5Ys9Mb7pgFzxlwx7Hus2d8g0JnaPjo0CPK4eUDe8qhKKZi7ppL7k
kL9ZFmMVBVD63x5NRPcGpPMQytQJt0Fi89lrvTXf+y+TOv/MsmEbOjSh5euIA9N7
rCNDGVuykgSj6MBKO4kEd0T6w/hrouEIJEFnXIpo5Bbav9FM4+IB+CPbfvrG16vq
zgf1R4Oh3UoCS4QTHlbV1C7xVAAw2jckRK+Rc/F5aN+i+HpSiheS3t8kk24gOB+m
xrar1Bt8lzbeY1RCZRgQkX9UJrhN13zpfuVQ4OHSqomj1Mtgs6G9Saa0vYmd0hI7
A/Gg2mKf1FeUq7uudJ/V4znS/nTRfVZaPZRSMb+M0Q/rzPFUx6+nzBDRBwDqFB01
zXg7Zj8a1f0JQ2BL0VIA994OLDznZYieCVMxWBBMSKgpwsgAyolY5Zak6c8izhkF
dGG9JTv7C2FMr/L3Pl4IifntfURxgTH3XkhRKgSZsJza5MO45GbOeJNy4t+b4A09
xzv1EjPj+hyI1QmzTqGBdPvywV4jb+v2Lmfg+nHL0W0LwMv7q5yCFCsNq9k0CMW9
HxZsx1P5KVWm91DMO1bk2DfouWNUr1v3GIux/5gPaZxUGu7Ve03L28ZIMIh+ZPJ4
1WD8PzsiJSyLnakOiLX6
=GFIb
-----END PGP SIGNATURE-----
More information about the Dnsmasq-discuss
mailing list