[RPi4] How to change DHCP IP lease time?

  • Hi,

    I'm running 12.0.2 on an RPI4B and so far everything seems to work fine apart from DHCP.

    I disabled both bluetooth and wifi. I'm using a network cable to connect to the lan.

    Problem is,when DHCP is selected, it always defaults to 192.168.1.126, even when I setup my router to assign 192.168.1.5 to the MAC used by the RPI.

    I noticed that when I use the command ip address, it outputs:


    What I want to try is to change the value for "valid_lft" and "preferred_lft" which seems to be set to forever.

    How do I change these two settings?

  • Problem is,when DHCP is selected, it always defaults to 192.168.1.126

    The output of ip a that you shared disagrees with that statement as it clearly shows eth0 is assigned 192.168.1.5/24 as configured in the router. What makes you think it has the address 192.168.1.126 ?

    The lifetime values can be manually changed with:

    Code
    ip a change <ip> dev eth0 valid_lft <value> preferred_lft <value>
  • The output of ip a that you shared disagrees with that statement as it clearly shows eth0 is assigned 192.168.1.5/24 as configured in the router. What makes you think it has the address 192.168.1.126 ?

    Oops, sorry for the confusion, that was after I changed the network settings from DHCP to a manually assigned address...

    If I changed the network settings back to DHCP, it magically selects 192.168.1.126, despite my router telling it should assign 192.168.1.5.

    With my old RPI3B with Libreelec 9.2.6 it worked fine.

    The lifetime values can be manually changed with:

    Code
    ip a change <ip> dev eth0 valid_lft <value> preferred_lft <value>

    Does that survive a reboot?

    Thanks for trying to help.