herzogf / homek8s

Kubernetes installer for your datacenter at home.
MIT License
1 stars 2 forks source link

gateway: fix changing IP addresses for same MAC during pxe install #55

Open herzogf opened 4 years ago

herzogf commented 4 years ago

We run in the same problem mentioned here: https://dnsmasq-discuss.thekelleys.org.narkive.com/ZoFQNaGo/always-ignore-client-identifier#post4

During PXE-install the new node gets an IP address with infinite lease based on MAC address AND client-id (client identifier) sent by the debian installer. After installation and upon reboot the node gets a different IP address (not the IP address during install) because the cliend-id changes.

Sample output from our dummy dhcp_hook script:

add fa:2d:37:78:7f:cf 192.168.2.106 k8s-node-106 01:fa:2d:37:78:7f:cf
...
add fa:2d:37:78:7f:cf 192.168.2.107 k8s-node-107 ff:37:78:7f:cf:00:01:00:01:25:d4:61:4d:fa:2d:37:78:7f:cf

Same MAC address (column 2) but different client-id (last column).

Some 5 years after requesting a feature to ignore client-ids for all DHCP requests there's finally a commit in dnsmasq that adds a new option "dhcp-ignore-clid" that does exactly what we need: http://thekelleys.org.uk/gitweb/?p=dnsmasq.git;a=commit;h=13a58f9590a7071ad4a8c8f7e4178c29a6b66be3

This feature should make it into dnsmasq 2.81 (current release is 2.80 , see http://thekelleys.org.uk/dnsmasq/CHANGELOG).

For a real fix we need to wait for dnsmasq 2.81 (or rather "the next release") and then add this option dhcp-ignore-clid. This issue stays open till this happens.

As a workaround we probably have to either

herzogf commented 4 years ago

Short note for me: When doing the workaround where our dhcp-hook script is intelligent enough to recognize pxe-install leases we cannot just release the lease directly as we don't know when the lease isPXEClient not needed anymore (i.e. installation has ended). Two options come to my mind:

herzogf commented 4 years ago

Another option (perhaps the easiest as a workaround until dnsmasq is released with the new "ignore client-id" feature): just set the dhcp client-id for the installed debian system to the same id the pxe debian installer uses. See https://github.com/tsugliani/packer-vsphere-templates/blob/5bd06b553f4ee270aaa607c8508981cb52dfd807/scripts/Linux/Debian/preseed.cfg#L38 as an example (but the debian buster installer seems to send "01:" (with leading 0))