[Kea-users] Lease same IP for same MAC

Roland Berger roland.berger at exasoft.ch
Sun Dec 27 21:55:58 UTC 2020


Hi Klaus

I just did it like you say and it worked. I don't like the solution 
because it is more work but for now its ok.
In the packer vsphere-iso builder 
https://www.packer.io/docs/builders/vsphere-iso.html I configured the 
'mac_address' according to this information 
https://docs.vmware.com/en/VMware-vSphere/7.0/com.vmware.vsphere.networking.doc/GUID-ADFECCE5-19E7-4A81-B706-171E279ACBCD.html 
and then configured a reservation in kea.

If somebody has a cleaner solution please let us know.

Best Roland

www.exasoft.ch <http://www.exasoft.ch>
On 12/27/20 9:59 PM, Klaus Steden wrote:
>
> I've got a similar workflow set up but I use VMware's /dcli/ module to 
> create my instance, which also allows me to explicitly set the MAC 
> address (and thus force reservations).
>
> Looking at the Packer docs 
> (https://www.packer.io/docs/builders/vsphere-iso.html) you may be able 
> to do this as well by defining the Network Adapter before starting the 
> instance, and use a reservation in Kea to fix the IP.
>
> hth,
> Klaus
>
> On Sun, Dec 27, 2020 at 10:40 AM Roland Berger 
> <roland.berger at exasoft.ch <mailto:roland.berger at exasoft.ch>> wrote:
>
>     Hi John
>
>     Thanks. Packer is a tool to automatically bring up and configure a
>     virtual machine for the first time. It is like installing, for
>     example an ubuntu, machine from an iso image: The installer runs
>     and after completion the new machine makes a reboot and you can
>     continue to configure the new machine. So, I do not know the MAC
>     address in advance to make a reservation.
>
>     The challenge I think I face is to make sure that the IP address
>     after the reboot is the same like during first power up when the
>     os installer is running.
>     I think I have to create a configuration where kea issues the same
>     IP for the above scenario. I tried this to make sure that the MAC
>     address and the hostname are the same. I also configured
>     networking of the new machine to send 'dhcp-identifier: mac'. But
>     that is obviously not enough.
>
>     Thanks to your answer I see the following things I can try. But
>     may be you have even a better, simpler idea.
>     - Create a MAC address by hand and make a reservation
>     - Try to play around with the lease time for the first DHCP request.
>     - Use static IP but in this case I don't want to do that if I can
>     avoid it.
>     - Configure kea to use only "host-reservation-identifiers":
>     ["hw-address"] but not sure if this would help.
>
>     Best Roland
>
>     192.168.178.*251*,00:50:56:92:07:82,01:00:50:56:92:07:82,0   ,1609062019,1,1,1,ubuntu-server,0,
>     192.168.178.*252*,00:50:56:92:07:82,01:00:50:56:92:07:82,4000,1609066573,1,1,1,ubuntu-server,0,
>
>
>
>     www.exasoft.ch <http://www.exasoft.ch>
>     On 12/27/20 12:06 PM, Gibbins, John (IM&T, Black Mountain) wrote:
>>     Hi Roland,
>>
>>     If the client does not request the same IP as it had before you probably need to assign a fixed IP to the device.
>>
>>     I'm assuming you have a config which includes your subnet.  Something like:
>>     ...
>>          "subnet4": [
>>            {
>>              "subnet": "192.168.178.0/24  <http://192.168.178.0/24>",
>>              ...
>>            }
>>          ]
>>     ...
>>
>>     To ensure that you always get the same IP you need to create a reservation which maps the MAC to the desired IP.  Such as:
>>     ...
>>          "subnet4": [
>>            {
>>              "subnet": "192.168.178.0/24  <http://192.168.178.0/24>",
>>              ...
>>              "reservations": [
>>                {
>>                  "hw-address": "00:50:56:92:07:82",
>>                  "ip-address": "192.168.178.251"
>>                }
>>              ]
>>            }
>>          ]
>>     ...
>>
>>     You may want to check out the "reservation-mode" attribute if you have both pools and reservations on the same subnet.
>>
>>     Regards
>>     johng
>>     -----Original Message-----
>>     From: Kea-users<kea-users-bounces at lists.isc.org>  <mailto:kea-users-bounces at lists.isc.org>  On Behalf Of rondal
>>     Sent: Sunday, 27 December 2020 9:23 PM
>>     To:kea-users at lists.isc.org  <mailto:kea-users at lists.isc.org>
>>     Subject: [Kea-users] Lease same IP for same MAC
>>
>>     Hi, I try to deploy an ubuntu server to vsphere with packer. After
>>     installation has finished the machine reboots an gets an other IP address.
>>     Packer can not complete its work because it is still trying to connect to
>>     the old ip address.
>>
>>      From the kea log I see the following:
>>
>>     192.168.178.*251*,00:50:56:92:07:82,01:00:50:56:92:07:82,0
>>     ,1609062019,1,1,1,ubuntu-server,0,
>>     192.168.178.*252*,00:50:56:92:07:82,01:00:50:56:92:07:82,4000,1609066573,1,1,1,ubuntu-server,0,
>>
>>     In the client I configure networking (netplan) with dhcp-identifier: mac
>>
>>     - Any ideas how I can tell kea to lease the same ip, in this case *.251,
>>     again?
>>
>>
>>     Best Roland
>>
>>
>>
>>     --
>>     Sent from:http://kea-users.7364.n8.nabble.com/
>>     _______________________________________________
>>     ISC funds the development of this software with paid support subscriptions. Contact us athttps://www.isc.org/contact/  for more information.
>>
>>     To unsubscribe visithttps://lists.isc.org/mailman/listinfo/kea-users.
>>
>>     Kea-users mailing list
>>     Kea-users at lists.isc.org  <mailto:Kea-users at lists.isc.org>
>>     https://lists.isc.org/mailman/listinfo/kea-users
>
>     _______________________________________________
>     ISC funds the development of this software with paid support
>     subscriptions. Contact us at https://www.isc.org/contact/ for more
>     information.
>
>     To unsubscribe visit https://lists.isc.org/mailman/listinfo/kea-users.
>
>     Kea-users mailing list
>     Kea-users at lists.isc.org <mailto:Kea-users at lists.isc.org>
>     https://lists.isc.org/mailman/listinfo/kea-users
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.isc.org/pipermail/kea-users/attachments/20201227/78aac978/attachment-0001.htm>


More information about the Kea-users mailing list