Changing DHCP lease times

L-plateAdmin
Contributor

Hi All,

We have just had a ticking off from our network guys about the insanly long times of the default DHCP settings of 90 days!

soulds like the only two options I could find would be a script that changes the leaselenth in /var/db/dhcpclient/en*<macid> .plist which seems back to front or trying to make a cron/laund job to trigger a tempoary refresh when we want.

Are there any nice computer configuration or networksetup command I've missed to set a system global limit??

cheers

4 REPLIES 4

bvrooman
Valued Contributor

Are you referring to leases assigned by a macOS server? Or the leases being assigned to macOS workstations?

If it's the former, there should be a setting in Server.app to configure the lease length.

If it's the latter, you'd want to change the lease duration on whatever device or server is leasing the IP addresses. For example, on Windows Server, the lease duration is set on the properties of the scope in question.

Look
Valued Contributor III

As @bvrooman said, lease time is usually specified at the DHCP server end. Change that and after 90 days all machines should be on the shorter lease length as all current leases will then have expired.

jcarr
Contributor III

Odd that the network guys are ticked off, since they should be in control of the DHCP lease times. To find your DHCP server, try this command in Terminal.app:

ipconfig getpacket en0

Where 'en0' is your network interface ('en0' is WiFi for Macs with no built-in ethernet, 'en1' is WiFi if you have built in ethernet).

L-plateAdmin
Contributor

yes I think your right as in it should be dictated by the network but I was wondering if there was something funky going on with wifi leases here is my Wi-Fi (en0) and a thunderbolt Eth (en4), 90 days for one and 3 days for the other!:

bash-3.2# ipconfig getpacket en0
op = BOOTREPLY
htype = 1
flags = 0
hlen = 6
hops = 0
xid = 0xd1252c30
secs = 0
ciaddr = 0.0.0.0
yiaddr = 180.161.83.186
siaddr = 0.0.0.0
giaddr = 180.161.82.3
chaddr = f4:5c:89:8a:fe:49
sname = file = options:
Options count is 9
dhcp_message_type (uint8): ACK 0x5
server_identifier (ip): 10.3.10.15
subnet_mask (ip): 255.255.254.0
domain_name_server (ip_mult): {10.3.10.10, 10.17.10.10}
nb_over_tcpip_name_server (ip_mult): {107.15.72.100, 107.15.73.100}
nb_over_tcpip_node_type (uint8): 0x8
lease_time (uint32): 0x76a700
router (ip_mult): {180.161.82.1}
end (none):

bash-3.2# ipconfig getpacket en4
op = BOOTREPLY
htype = 1
flags = 0
hlen = 6
hops = 0
xid = 0x6dadf4f0
secs = 0
ciaddr = 0.0.0.0
yiaddr = 10.7.8.125
siaddr = 0.0.0.0
giaddr = 10.7.9.252
chaddr = 38:c9:86:37:2:24
sname = file = options:
Options count is 9
dhcp_message_type (uint8): ACK 0x5
server_identifier (ip): 10.3.10.15
subnet_mask (ip): 255.255.254.0
domain_name_server (ip_mult): {10.3.10.10, 10.17.10.10}
nb_over_tcpip_name_server (ip_mult): {107.15.73.100, 107.15.72.100}
nb_over_tcpip_node_type (uint8): 0x8
lease_time (uint32): 0x40290
router (ip_mult): {10.7.9.254}
end (none):