Dhclient: prevent from using recorded lease



  • Does anyone know how to prevent dhclient from using the recorded lease?
    Sometimes my ISP DHCP Server (or maybe the modem) goes down and after dhclient tries for a while it uses the recorded lease but at the same times deletes the old routes taking PFSense offline!
    Ideally I would want PFSense to keep trying until the DHCP Server is back up but if that is not possible then it should not delete the old routes. Maybe then PFSense would be back online.

    Log looks like this, last entry on  top:

    
    Aug 16 03:22:21	dhclient	19144	bound: renewal in 135593 seconds.
    Aug 16 03:22:21	dhclient		Deleting old routes
    Aug 16 03:22:20	dhclient		New Routers (em0): 8.12.244.1
    Aug 16 03:22:19	dhclient		New Routers (em0): 8.12.244.1
    Aug 16 03:22:19	dhclient		New Broadcast Address (em0): 255.255.255.255
    Aug 16 03:22:19	dhclient		New Subnet Mask (em0): 255.255.255.0
    Aug 16 03:22:19	dhclient		New IP Address (em0): 8.12.244.25
    Aug 16 03:22:19	dhclient		ifconfig em0 inet 8.12.244.25 netmask 255.255.255.0 broadcast 255.255.255.255
    Aug 16 03:22:19	dhclient		Starting add_new_address()
    Aug 16 03:22:19	dhclient		TIMEOUT
    Aug 16 03:22:19	dhclient	19144	Trying recorded lease 8.12.244.25
    Aug 16 03:22:19	dhclient	19144	No DHCPOFFERS received.
    Aug 16 03:21:52	dhclient	19144	DHCPDISCOVER on em0 to 255.255.255.255 port 67 interval 27
    Aug 16 03:21:39	dhclient	19144	DHCPDISCOVER on em0 to 255.255.255.255 port 67 interval 13
    Aug 16 03:21:27	dhclient	19144	DHCPDISCOVER on em0 to 255.255.255.255 port 67 interval 12
    Aug 16 03:21:22	dhclient	19144	DHCPDISCOVER on em0 to 255.255.255.255 port 67 interval 5
    Aug 16 03:21:20	dhclient	19144	DHCPDISCOVER on em0 to 255.255.255.255 port 67 interval 2
    Aug 16 03:21:19	dhclient	19144	DHCPDISCOVER on em0 to 255.255.255.255 port 67 interval 1
    Aug 16 03:21:18	dhclient	19144	DHCPDISCOVER on em0 to 255.255.255.255 port 67 interval 1
    Aug 16 03:21:17	dhclient	19144	DHCPREQUEST on em0 to 255.255.255.255 port 67
    Aug 16 03:21:16	dhclient	19144	DHCPREQUEST on em0 to 255.255.255.255 port 67
    Aug 16 03:21:16	dhclient		PREINIT
    Aug 16 03:20:38	dhclient	8577	exiting.
    Aug 16 03:20:38	dhclient	8577	connection closed
    
    

    After using the recorded lease the default route in the IPv4 Routes table is missing!

    Thanks!



  • Your connection to the modem stays up, but what tells you that only the DHCP server is down on the other side ? That quiet rare.
    The entire connection - between your modem and your ISP is probably down. Keeping routes or reusing the 'old' IP doesn't make any sense.

    When the situation arrives, connect yourself to your modem directly (or make it accessible from pfSense) and see if a connection (like ADSL, cable or whatever) exists ….



  • I also think it makes no sense to use the 'old' IP but this is standard behavior of dhclient.

    If you look at the beginning of the log (Aug 16 03:20:38) you will see dhclient: connection closed, exiting. Possibly because the Modem is restarting, I cannot verify this because it happens randomly and mostly at night, every few days. Then about a minute later a new process of dhclient starts PREINIT and requests a lease. After 60 seconds (default setting) of trying it gives up (TIMEOUT), it then uses the recorded lease ending with .25 which is the old lease. I always get the same dynamic IP from the ISP.

    This would all be fine since the lease seems to still be valid (renewal in 135593 seconds, 37,6h), but in the end the dhclient deletes the 'old routes' taking PFSense offline because it deletes the default route! And then it is offline for the next 37,6 hours until it renews the lease again or I manually renew it.

    This seems to be a bug that quite a few people are struggling with or at least it seems that way when searching the forum.
    I think it is a bug because the 'old routes' are not old routes if the same (old) lease is used again!

    Do you see the problem?