OPNsense Forum

English Forums => 24.1 Production Series => Topic started by: paulwithonep on March 03, 2024, 05:04:21 pm

Title: Frequent DHCP renewals
Post by: paulwithonep on March 03, 2024, 05:04:21 pm
I've been trying to track down an issue with opnsense 24.1.2 and my WAN connection dropping, and I noticed in the logs that dhclient is renewing frequently, about every 2-3 minutes. I enabled IPv6 info logging so it's a little bit more noisy than usual. I am unsure what to check next. Any ideas? Thanks in advance.

Quote
2024-03-03T08:54:30-07:00   Notice   opnsense   /usr/local/etc/rc.newwanipv6: No IP change detected (current: {redacted}, interface: wan)   
2024-03-03T08:53:32-07:00   Notice   dhclient   dhclient-script: Creating resolv.conf   
2024-03-03T08:53:32-07:00   Notice   dhclient   dhclient-script: Reason RENEW on igc3 executing   
2024-03-03T08:53:24-07:00   Notice   opnsense   /usr/local/etc/rc.newwanipv6: No IP change detected (current: {redacted}, interface: wan)   
2024-03-03T08:52:06-07:00   Notice   opnsense   /usr/local/etc/rc.newwanipv6: No IP change detected (current: {redacted}, interface: wan)   
2024-03-03T08:51:07-07:00   Notice   opnsense   /usr/local/etc/rc.newwanipv6: No IP change detected (current: {redacted}, interface: wan)   
2024-03-03T08:51:05-07:00   Notice   dhcp6c   got an expected reply, sleeping.   
2024-03-03T08:51:05-07:00   Notice   dhcp6c   removing an event on igc3, state=RENEW   
2024-03-03T08:51:05-07:00   Notice   dhcp6c   script "/var/etc/dhcp6c_wan_script.sh" terminated   
2024-03-03T08:51:05-07:00   Notice   dhcp6c   dhcp6c_script: RENEW on igc3 executing   
2024-03-03T08:51:05-07:00   Notice   dhcp6c   executes /var/etc/dhcp6c_wan_script.sh   
2024-03-03T08:51:05-07:00   Notice   dhcp6c   update a prefix {redacted}::/56 pltime=600, vltime=1200   
2024-03-03T08:51:05-07:00   Notice   dhcp6c   update an IA: PD-2   
2024-03-03T08:51:05-07:00   Notice   dhcp6c   nameserver[1] {redacted}   
2024-03-03T08:51:05-07:00   Notice   dhcp6c   nameserver[0] {redacted}   
2024-03-03T08:51:05-07:00   Notice   dhcp6c   get DHCP option DNS, len 32   
2024-03-03T08:51:05-07:00   Notice   dhcp6c   IA_PD prefix: {redacted}::/56 pltime=600 vltime=1200   
2024-03-03T08:51:05-07:00   Notice   dhcp6c   get DHCP option IA_PD prefix, len 25   
2024-03-03T08:51:05-07:00   Notice   dhcp6c   IA_PD: ID=2, T1=300, T2=480   
2024-03-03T08:51:05-07:00   Notice   dhcp6c   get DHCP option IA_PD, len 41   
2024-03-03T08:51:05-07:00   Notice   dhcp6c   DUID: {redacted}   
2024-03-03T08:51:05-07:00   Notice   dhcp6c   get DHCP option server ID, len 10   
2024-03-03T08:51:05-07:00   Notice   dhcp6c   DUID: {redacted}
2024-03-03T08:51:05-07:00   Notice   dhcp6c   get DHCP option client ID, len 14   
2024-03-03T08:51:05-07:00   Notice   dhcp6c   receive reply from {redacted}::1 on igc3   
2024-03-03T08:51:05-07:00   Notice   dhcp6c   send renew to ff02::1:2%igc3   
2024-03-03T08:51:05-07:00   Notice   dhcp6c   set IA_PD   
2024-03-03T08:51:05-07:00   Notice   dhcp6c   set IA_PD prefix   
2024-03-03T08:51:05-07:00   Notice   dhcp6c   set option request (len 4)   
2024-03-03T08:51:05-07:00   Notice   dhcp6c   set elapsed time (len 2)   
2024-03-03T08:51:05-07:00   Notice   dhcp6c   set server ID (len 10)   
2024-03-03T08:51:05-07:00   Notice   dhcp6c   set client ID (len 14)   
2024-03-03T08:51:05-07:00   Notice   dhcp6c   a new XID (7d9492) is generated   
2024-03-03T08:51:05-07:00   Notice   dhcp6c   reset a timer on igc3, state=RENEW, timeo=0, retrans=9384   
2024-03-03T08:51:05-07:00   Notice   dhcp6c   IA timeout for PD-2, state=ACTIVE   
2024-03-03T08:51:02-07:00   Notice   dhclient   dhclient-script: Creating resolv.conf   
2024-03-03T08:51:02-07:00   Notice   dhclient   dhclient-script: Reason RENEW on igc3 executing   
2024-03-03T08:50:14-07:00   Notice   opnsense   /usr/local/etc/rc.newwanipv6: No IP change detected (current: {redacted}, interface: wan)   
2024-03-03T08:48:32-07:00   Notice   dhclient   dhclient-script: Creating resolv.conf   
2024-03-03T08:48:32-07:00   Notice   dhclient   dhclient-script: Reason RENEW on igc3 executing   
2024-03-03T08:48:23-07:00   Notice   opnsense   /usr/local/etc/rc.newwanipv6: No IP change detected (current: {redacted}, interface: wan)   
2024-03-03T08:46:39-07:00   Notice   opnsense   /usr/local/etc/rc.newwanipv6: No IP change detected (current: {redacted}, interface: wan)   
2024-03-03T08:46:07-07:00   Notice   opnsense   /usr/local/etc/rc.newwanipv6: No IP change detected (current: {redacted}, interface: wan)
... and it just repeats like this every few minutes.
Title: Re: Frequent DHCP renewals
Post by: zan on March 04, 2024, 05:55:01 am
Quote
2024-03-03T08:51:05-07:00   Notice   dhcp6c   IA_PD prefix: {redacted}::/56 pltime=600 vltime=1200   
2024-03-03T08:51:05-07:00   Notice   dhcp6c   get DHCP option IA_PD prefix, len 25   
2024-03-03T08:51:05-07:00   Notice   dhcp6c   IA_PD: ID=2, T1=300, T2=480   

Your log shows dhcp6c requested default lease time of 300s and max time of 480s. Your ISP granted you a preferred lifetime of 600s and max lifetime of 1200s. Those values are too short that's why it kept renewing.

Are you using a custom dhcp6c.conf? If not, can you post the content of your /var/etc/dhcp6c_wan.conf?
Title: Re: Frequent DHCP renewals
Post by: paulwithonep on March 04, 2024, 04:24:37 pm
Thanks for the reply. I am not using a custom dhcp6c.conf to my knowledge. Here is the conf file:

Quote
interface igc3 {
  send ia-na 2; # request stateful address
  send ia-pd 2; # request prefix delegation
  request domain-name-servers;
  request domain-name;
  script "/var/etc/dhcp6c_wan_script.sh"; # we'd like some nameservers please
};
id-assoc na 2 { };
id-assoc pd 2 {
  prefix ::/56 infinity;
  prefix-interface igc0 {
    sla-id 0;
    sla-len 8;
  };
};
Title: Re: Frequent DHCP renewals
Post by: meyergru on March 04, 2024, 04:59:26 pm
Is there any special reason why you use IAID 2 instead of 0?

Maybe the offered lease time is too short because of this. Look at the "advanced" tab of the options, you can see and modify the IAID there.
Title: Re: Frequent DHCP renewals
Post by: zzup on March 04, 2024, 11:27:48 pm
I just looked at my logs as i have been having disconnects and reboots a couple times a day.  I found that my DHCP is renewing every 2 hours from my isp and that is when the issue happens.  Similar issue to yours.  I do not have any custom setting for lease for my wan. 
Title: Re: Frequent DHCP renewals
Post by: zan on March 05, 2024, 05:14:55 am
Your dhcpc6.conf seems normal. Could be your ISP side also possible that your ISP expects real values for both preferred life time & valid lifetime during request instead of 'infinity'.
Can you try to specify both values on dhcp6 config?

One way to do it is to copy your /var/etc/dhcpc6.conf to /var/etc/mydhcp6.conf, edit mydhcp6.conf and replace the line
Code: [Select]
prefix ::/56 infinity; with
Code: [Select]
prefix ::/56 86400 172800;
Then put /var/etc/mydhcp6.conf on your WAN>Config File Override>Configuration File Override field and reboot.

If it still doesn't get your a longer lease then I suggest you check with your ISP.
Title: Re: Frequent DHCP renewals
Post by: Fuggin on March 11, 2024, 09:19:46 pm
I have the same problem with this but I am just using IPv4. My WAN drops out completely and I have to hard reboot the NUC. I get the same DHCP renewals on my logs but I am not sure it is the source of my WAN dropping out:

Code: [Select]
2024-03-11T16:13:41-04:00 Notice dhclient dhclient-script: Creating resolv.conf
2024-03-11T16:13:41-04:00 Notice dhclient dhclient-script: Reason RENEW on vtnet0 executing
2024-03-11T16:13:41-04:00 Error dhclient unknown dhcp option value 0x7d