What does `# dhcpleasectl -l cnmac2` output on the machine you are using?

Mine (OpenBSD 7.3 amd64 vm on the LAN) looks like this (anonymised):
root@vm2:~# dhcpleasectl -l vio0
vio0 [Bound]
inet 192.168.x.220 netmask 255.255.255.0
default gateway 192.168.x.1
nameservers 192.168.x.1
lease 24 hours              <==== what is your lease time?
dhcp server 192.168.x.1
root@vm2:~# 

I suspect your lease time is much higher than 5 min. An ISP issuing leases as 
short as 5 min. would be highly unusual.

You could try running dhcpleased manually like this to see details about what 
is going on:
# dhcpleased -vv -d

(But you’d need to stop the processes started by rc(8) first. E.g.: `# rcctl 
stop dhcpleased`. Don’t forget to `# rcctl start dhcpleased` when you are done 
with the testing.)


Does the interface go down and up for some reason every 5 minutes? That might 
cause dhcpleased(8) to renew the lease.


HTH
Mike

> Am 10.05.2023 um 07:28 schrieb Otto Moerbeek <o...@drijf.net>:
> 
> On Wed, May 10, 2023 at 01:17:05PM +1000, David Diggles wrote:
> 
>> 
>> Just to update, I've added the following to dhclient.conf but
>> it's still renewing every 5 minutes (approximately) and the
>> default route is disappearing for a couple of seconds. :(
>> 
>> send dhcp-lease-time 86400;
> 
> dhcpleased does not use dhclient.conf, it used dhcpleased.conf, which
> does not have a way to influence the lease time requested (if that is a
> thing).
> 
> -Otto
>> 
>> On Wed, May 10, 2023 at 01:00:00PM +1000, David Diggles wrote:
>>> My ISP provides connection via DHCP.
>>> 
>>> Every 5 minutes or so when dhcpleased is renewing the lease,
>>> my default route disappears for a few seconds.
>>> 
>>> Definitely I'll be looking at requesting a longer lease by
>>> putting a setting in /etc/dhclient.conf but is there any way
>>> I can stop the default route disappearing with each renew event?
>>> 
>>> The route didn't disappear when I tested with NetBSD and Linux.
>>> 
>>> This seems like I'm missing a setting in dhclient.conf to make
>>> the default route sticky? I can't see any obvious answers in
>>> the man page for dhclient.conf unfortunately.
>>> 
>>> (IP fudged log snippet below)
>>> 
>>> May 10 12:23:21 openbsd-gateway dhcpleased[77979]: deleting nameservers 
>>> x.x.x.x x.x.x.x (lease from x.x.x.1 on cnmac2)
>>> May 10 12:23:21 openbsd-gateway dhcpleased[77979]: deleting x.x.x.30 from 
>>> cnmac2 (lease from x.x.x.1)
>>> May 10 12:23:23 openbsd-gateway dhcpleased[77979]: adding x.x.x.30 to 
>>> cnmac2 (lease from x.x.x.1)
>>> May 10 12:23:23 openbsd-gateway dhcpleased[77979]: adding nameservers 
>>> x.x.x.x x.x.x.x (lease from x.x.x.1 on cnmac2)
>>> May 10 12:28:23 openbsd-gateway dhcpleased[77979]: deleting nameservers 
>>> x.x.x.x x.x.x.x (lease from x.x.x.1 on cnmac2)
>>> May 10 12:28:23 openbsd-gateway dhcpleased[77979]: deleting x.x.x.30 from 
>>> cnmac2 (lease from x.x.x.1)
>>> May 10 12:28:25 openbsd-gateway dhcpleased[77979]: adding  x.x.x.30 to 
>>> cnmac2 (lease from x.x.x.1)
>>> May 10 12:28:25 openbsd-gateway dhcpleased[77979]: adding nameservers 
>>> x.x.x.x x.x.x.x (lease from x.x.x.1 on cnmac2)
>>> May 10 12:33:26 openbsd-gateway dhcpleased[77979]: deleting nameservers 
>>> x.x.x.x x.x.x.x (lease from x.x.x.1 on cnmac2)
>>> May 10 12:33:26 openbsd-gateway dhcpleased[77979]: deleting x.x.x.30 from 
>>> cnmac2 (lease from x.x.x.1)
>>> May 10 12:33:28 openbsd-gateway dhcpleased[77979]: adding x.x.x.30 to 
>>> cnmac2 (lease from x.x.x.1)
>>> May 10 12:33:28 openbsd-gateway dhcpleased[77979]: adding nameservers 
>>> x.x.x.x x.x.x.x (lease from x.x.x.1 on cnmac2)
>>> May 10 12:38:28 openbsd-gateway dhcpleased[77979]: deleting nameservers 
>>> x.x.x.x x.x.x.x (lease from x.x.x.1 on cnmac2)
>>> May 10 12:38:28 openbsd-gateway dhcpleased[77979]: deleting  x.x.x.30 from 
>>> cnmac2 (lease from x.x.x.1)
>>> May 10 12:38:30 openbsd-gateway dhcpleased[77979]: adding  x.x.x.30 to 
>>> cnmac2 (lease from x.x.x.1)
>>> May 10 12:38:30 openbsd-gateway dhcpleased[77979]: adding nameservers 
>>> x.x.x.x x.x.x.x (lease from x.x.x.1 on cnmac2)
>>> 
>> 

-- 
Mike Fischer
fisc...@lavielle.com

Reply via email to