How to client DHCP renewal on boot only

Started by zeropage, May 21, 2024, 08:28:32 PM

Previous topic - Next topic
May 21, 2024, 08:28:32 PM Last Edit: May 21, 2024, 08:30:07 PM by zeropage
Hello everyone,

I am using the DHCPv4 service on my OPNsense. Connected to it is a Proxmox host with some VMs. Each guest is assigned an IPv4 address via static lease. The guests are running Debian Bookworm with ifup and dhclient. However, the dhclient now makes a DHCPREQUEST about every hour. Because the IP addresses almost never change, a DCHP request during boot would be enough. What do I have to configure? Don't find any hints for dhclient.

I don't want to set a static IP on the guests, because in my opinion this is the task of the DHCP server.


# /etc/network/interfaces
allow-hotplug ens18
iface ens18 inet dhcp


Hi,

you can increase the lease time

https://forum.opnsense.org/index.php?topic=8806.0

But I would recommend against it. Once you change your network settings you will find out that they are not propagated through DHCP. Why don't you like static IPs?

Quote from: Saarbremer on May 22, 2024, 05:28:24 PM
But I would recommend against it. Once you change your network settings you will find out that they are not propagated through DHCP. Why don't you like static IPs?

It's not that a don't like static IPs at all. In my opinion, it is a question of responsibility. I often read that a fixed IP address is configured for servers on the server itself using ifup or network manager. However, the operator of the network segment should be responsible for this. The DHCP service should therefore not only assign dynamic addresses, but also static ones. DHCP clients do not need to ask every hour for an address that rarely or never changes.

Unfortunately, it is not clear to me whether I should configure something on the OPNsense for this. Or whether and how I tell the dhclient on the host that a DHCPREQUEST at system boot is sufficient.

May 28, 2024, 10:22:29 AM #3 Last Edit: May 28, 2024, 03:46:30 PM by meyergru
You were already told that you can change the default and maximum DHCP lease time in the advanced settings of ISC DHCP server. You should not do this on the client. Even if you did this by just using a DHCP request once at boot, the lease may expire on the server and get assigned to some other machine.
Intel N100, 4* I226-V, 2* 82559, 16 GByte, 500 GByte NVME, ZTE F6005

1100 down / 800 up, Bufferbloat A+

QuoteDHCP clients do not need to ask every hour for an address that rarely or never changes.

But that's exactly what the protocol dictates. If you don't like it come up with your own. And eventually converge it to DHCP. I agree with your initial statement that network operation should not be done on several locations - but I mitigate around it.

Servers are always in their own segment (different level of security = different network segment). So assign static IPs only, no DHCP.

BTW: What is your opinion on RAs in an IPv6 network then? Too much traffic? And that goes way more often than 1/h

Perhaps you want to check https://datatracker.ietf.org/doc/html/rfc2131 and the isc implementation https://kb.isc.org/docs/isc-dhcp-41-manual-pages-dhcpdconf
Places I've worked in where there are (very many) servers, they usually have defined and documented ip addresses because of system integrations in the past went with ip addresses. So the network engineering team assigned the IPs and were documented somewhere. Then they were placed as static leases on the DHCP servers.
Are there much better ways these days, of course. I mean DNS has been around for ever, right. Not easy to change decades of undocumented systems setup with ip in obscure places, from config files to inline code. Bad practices that become technical debt.
In summary as the others have said, set it on the dhcp side. Let the client do what they do. Different OSes do the client part differently but noone has to worry about it.