MacOS Server DHCP lease duration change

macosNetworkserver.app

Running MacOS Server 5.2 on El Capitan. I'd like to change the DHCP server's lease duration. I'd like to use 8 hours but the GUI only gives me a choice of 1 hour, or 1 Day, or higher.

Can anyone help me with a terminal command to achieve this please?

I've found sudo serveradmin settings dhcp | grep lease which lets me see DHCP settings, but I just cannot work out how to change the lease period.

Best Answer

First enter - to get an overview and the appropriate array_idUUID:

sudo serveradmin settings dhcp

Then (with the proper array_idUUID)

sudo serveradmin settings dhcp:subnets:_array_id:array_idUUID:lease_max = 28800

Example:

sudo serveradmin settings dhcp:subnets:_array_id:A387646D-BBC1-88CD-993E-2D36E15C5089:lease_max = 28800

Then restart the DHCP service:

sudo serveradmin stop dhcp
sudo serveradmin start dhcp

Check the new settings with sudo serveradmin settings dhcp