On 1/9/2019 11:38 AM, MIchael Schleicher wrote:
> 
> On 09.01.19 08:14, john doe wrote:
>> On 1/8/2019 11:31 AM, smicha wrote:
>>> Hi John,
>>>
>>> thanks for your reply.
>>>
>>> I did some tests with your hints.
>>>
>>> On 7.1.2019 17:41, john doe wrote:
>>>>
>>>> Some hints from dnsmasq.conf:
>>>>
>>>> # Give the machine which says its name is "bert" IP address
>>>> # 192.168.0.70 and an infinite lease
>>>> #dhcp-host=bert,192.168.0.70,infinite
>>>
>>> Do not work with my setup, because when we re-deploy a VM, the MAC
>>> address will be autom. changed.
>>> The re-delpoyed VM will than get a different IP as the old vm had
>>> before.
>>>
>>
>> I just tested this option  and the behavior described is correct with
>> dnsmasq 2.76, from the man page:
> 
> I have running the version 2.78.
> 
>> "--dhcp-host=lap,192.168.0.199 tells dnsmasq to always allocate the
>> machine lap the IP address 192.168.0.199.
>> Addresses allocated like this are not constrained to be in the range
>> given by the --dhcp-range option, but they must be in the same subnet as
>> some valid dhcp-range. For subnets which don't need"
> 
> Yes, the config "--dhcp-host=lap,192.168.0.199" is working. The VM with
> the hostname "lap" will get the IP 192.168.0.199.
> 
> But, I have the problem, when I have a new VM, a new version of the VM
> "lap" which have a different MAC address.
> Than, that new version of VM "lap" get not the 192.168.0.199. They get
> an other IP from the pool.
> 
>> As long as a client use the hostname ("lap") the same IP will always be
>> given to that client, the MAC address is not used.
>>
> 
> As far as I see, for the "first" IP provisioning that is true -> the
> Hostname is enough.
> But, than the "dnsmasq.leases" file have also the MAC address and
> Client-ID values stored, which will be compared an the next DHCP Requests.
> If than one of the values are different (MAC, CLIENT-ID) the DHCP-Client
> will get an other IP.
> 
> Please see below, a example...
> 
> 
>>>>
>>>> See also (1) for more info on 'dhcp-host'.
>>>>
>>>>
>>>> 1)  http://www.thekelleys.org.uk/dnsmasq/docs/dnsmasq-man.html
>>>
>>>
>>> Maybe is it possible to "patch" the code of dnsmasq, where dnsmasq can
>>> ignore the MAC address in the DHCP task?
>>>
>>
>> Possibly, more nolageable dnsmasqer would need to chime in to do that
>> though! :)
>> If '--dhcp-host=hostname,IP' is not working for you more info would need
>> to be provided.
>>
> 
> 
> BTW: the VM "lap" does not have set a special "DHCP-Client-Identifier",
> so it use for DHCP-Client-ID the MAC address.
> 
> 
> Here some outputs of the dnsmasq.leases file:
> 
> # inital DHCP-Request:
> 
> 1547107342 00:50:56:85:02:fa 192.168.0.199 lap 01:00:50:56:85:02:fa
> 
> As you can see, the VM "lap" (MAC 00:50:56:85:02:fa) get the expected IP
> -> so far so good.
> 
> 
> Next, I power off the VM "lap" without a DHCP-Release and deploy a copy
> of the VM "lap" which have than an other MAC (00:50:56:85:02:ff) ! ->
> the MAC will always set by the deployment of a new VM version.
> 
> 
> Now, I start the new version of the VM "lap" (the old version of the VM
> "lap" is no longer available.
> 
> The dnsmasq.leases looks now, like this:
> 1547116110 00:50:56:85:02:ff 192.168.0.200 lap 01:00:50:56:85:02:ff
> 1547107342 00:50:56:85:02:fa 192.168.0.199 * 01:00:50:56:85:02:fa
> 
> 
> As you see, the VM "lap" have now the IP "192.168.0.200" and not the
> expected IP "192.168.0.199.
> 
> Do you have an idea how I can fix that?
> I tested different options with "--dhcp-host", but with no luck.
> 
> I hope you can help my.
> 

Beside looking at the VM software to always assign the same MAC address
to the same guest and the fact that I'm able to reproduce what you are
seeing, that is all I can offer.

-- 
John Doe

_______________________________________________
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss

Reply via email to