LibreElec 9.2.1: no more DHCP after a while

  • Hi,

    It looks like since 9.2.1, LibreElec does a DHCP request at startup and then never renews the lease.

    This is problematic because it means its name is lost (on my network at least) after the lease expires, which means I can't find it on the network with a mobile phone or trying to use the Chorus web interface.

    Any hint on what could have gone wrong, and how to fix this ?

  • I've got a homemade router running dnsmasq, and the box running Libreelec is on a wired connection. Up until before 9.2.1 everything worked well, but after that last upgrade I observed:

    - no DHCP identifier has been sent to dnsmasq, I had to force associating the name to the MAC address in dnsmasq's config

    - even then sometimes after a while I see no RENEW, the box still works but dnsmasq has lost its name, so if I want to access it from elsewhere on the network I have to restart it

    If you look at dnsmasq's log:

    You see a first REQUEST from the box's bios (I guess, because I boot the box via PXE), a second one from LibreElec, and then nothing - since 5 hours, whereas my lease period is 2 hours. Clearly LibreElec's dhcp client doesn't send RENEW when it should, which means it "disappears" from the network.

    Edited 2 times, last by xav: Add dnsmasq log (March 18, 2020 at 12:35 PM).

  • This is the expected behavior when the kernel uses ip autoconfiguration. Make sure you set up a static DNS entry in addition to the static DHCP lease.

    so long,

    Hias

  • How can the DHCP server know if an IP address is still in use if the client doesn't RENEW when the lease expires ? I'd like to know where it's an expected behavior, because that looks more like a DHCP protocol violation to me.

  • While I agree that full DHCP conformance would be nice, kernel ip autoconfiguration, especially in combination with netboot/nfsroot is a rather special case. The assigned IP addresses have to be static and permanent.

    Consider what would happen if the DHCP server wouldn't renew your lease or give you a different IP. Basically all the client could do in that case is panic - you can't just shutdown network (as the rootfs would be lost) or unmount the NFS root and set up a new IP (when your NFS root is gone so are ifconfig, mount etc).

    It's best to see the kernel DHCP implementation as a nice shortcut so you don't have to manually specify the network parameters in the ip=... kernel option, more like BOOTP or RARP.

    See also the discussion in the predecessor of the linked PR connman: ignore kernel-configured netdev and improve resolv.conf handling by HiassofT · Pull Request #3883 · LibreELEC/LibreELEC.tv · GitHub


    so long,

    Hias

  • Again, it's not a bug in LibreELEC but with the way you set up netboot and your DHCP server.

    For netboot you need manual allocation ("static" DHCP leases), not dynamic allocation. Manual allocation doesn't require the lease to be renewed.

    See also the explanation in the DHCP RFC RFC 2131 - Dynamic Host Configuration Protocol

    Quote

    In "manual allocation", a client's IP address is assigned by the network administrator, and DHCP is used simply to convey the assigned address to the client.

    so long,

    Hias

  • It seems to me the proper way is to do normal DHCP (RENEW etc.) but asking for an "infinite" (0xFFFFFFFF) duration.

    Cf 2.2 and 3.3 in the RFC.