Frequent Unbound restarts with pfsense+ 25.11.1
-
@SteveITS Yes. correct.
I just observed that in General Log.
My Mac connected directly to SG-5100 port has static IP. However, when it goes to sleep and wakesup pfsense recongnises that as "NEW" IP and forces the reload of packages. This included UPS and DNS in my case.
Even if your DNS is listining on localhost and outgoing interfaces is set to WAN it will perform a restart. This is causing DNS to stop and start.
I dont know the reasons behind the "why" but it just does it so I hope people will be aware. I find it strange that pfsense is doing it. -
@markster yep that is the classic reason. The interface is going down and up. If you put a switch in between, that will resolve this.
-
@markster, you could also check to see if there is an option within your Mac OS to disable sleep for the network port. That option exists for Windows, but I'm not sure about Mac (but I suspect there is such a setting).
As stated by others above, the services restart is caused by pfSense seeing the network interface physically go down and then come back as your connected Mac is causing a link-down event (same thing as unplugging the network cable) when it enters sleep mode and then later wakes up.
-
@markster said in Frequent Unbound restarts with pfsense+ 25.11.1:
I dont know the reasons behind the "why" but it just does it so I hope people will be aware. I find it strange that pfsense is doing it.
pfSense ?
Take any OS, the one from Redmond, all Linux branches, FreeBSD, and so on.
Processes that use network interfaces on these systems receive a network event when the interface changes state. Most of them handle it with a 'restart'.
Why a brutal 'restart' ? Probably because there are reasons to do so, ask the programmers ^^ Some kind of internal reload might do just fine. Afaik, postfix does this, and bind (world's biggest DNS server) does so.As already said above, I protect all my 'expensive' pfSense network ports by inexpensive switches.
Nice side effect : pfSense interfaces never go down. -
@Gertjan Tried it with the GS308T I had around and indeed that solved the issue.
-
This post is deleted! -
Same symptom here, different trigger: traced to an unconditional system_hosts_generate() in rc.newwanip
pfSense Plus 26.07, pfBlockerNG 3.2.17_1 (DNSBL in Python mode, about 5.9M domains), Kea DHCP.
My ISP gives a 1800 s DHCP lease with renewal at 900 s. Every renewal returns the same IP, but each one runs rc.newwanip and Unbound reloads in place: same PID, log line Restart of unbound. With pfBlockerNG in Python mode, the module takes about 7 s to re-initialise. During that time no queries are answered, and afterwards the cache is empty. This happens 96 times a day.
Trace:
The IP-change block in /etc/rc.newwanip (line 239, which contains services_unbound_configure()) is correctly skipped. /var/db/em0_cacheip matches the current IP and there is no /tmp/wan_upstart4.
However, line 153 calls system_hosts_generate() unconditionally on every run.
system_hosts_generate() (system.inc:711) â unbound_hosts_generate() â unbound_control("reload") (unbound.inc:1150). The reload runs whether or not host_entries.conf changed.
Binding Unbound to selected interfaces does not help on this path. That check lives in services_unbound_configure(), and this path does not call it. My Network Interfaces setting already excludes WAN and âAllâ.This may also explain the link up/down case earlier in this thread, if rc.newwanip runs for those interfaces. I havenât tested that.
Local workaround (System Patches, strip 1, base /): reload only when the host entries actually change.
--- a/etc/inc/unbound.inc +++ b/etc/inc/unbound.inc @@ -1144,8 +1144,17 @@ // Generate hosts and reload services function unbound_hosts_generate() { + global $g; + $hostfile = "{$g['unbound_chroot_path']}/host_entries.conf"; + $oldhash = file_exists($hostfile) ? md5_file($hostfile) : ''; + // Generate our hosts file unbound_add_host_entries(); - // Reload our service to read the updates + // Local patch: reload only if the host entries changed. Avoids a full + // Unbound + pfBlockerNG reload on every same-IP WAN DHCP renewal. + clearstatcache(); + if (($oldhash !== '') && (@md5_file($hostfile) === $oldhash)) { + return; + } unbound_control("reload"); }Suggested upstream fix: add the same unchanged-file check in unbound_hosts_generate(), or move the system_hosts_generate() call in rc.newwanip inside the IP-changed block.
-
I totally understand you want to skip process restarting when 'nothing changed'.
My unbound (Resolver) restart daily at :
2026-11-02 00:45:26.099658+01:00 unbound 43522 [43522:0] info: start of service (unbound 1.26.1).every day at 00:45, and that's probably because pfBlocker does it's thing.
My pfSense WAN uses DHCPv4.
The DHCPv4 server is my upstream ISP router.
My ISP (upstream router) has my pfSense renew it's DHCPv4 lease every 43200 seconds or 12 hours.
When I compare the pfSense DHCPv4 WAN event (lease renewal) (always the same IPv4 of course, as I've "MAC-locked" it in the ISP router) with the moment unbound restarts, then I notice that unbound doesn't get restarted when the DHCPv4 event happens.
For me, the logic "When a new WAN IP (lease) is the same as the old WAN IP (lease), do nothing" seems to work fine.
Yours does.
So, what's different ?Does your dhclient has to try many times ?
For example, half way during the total lease duration, de DHCPv4 client asks for a renewal.
When that doesn't work out, it repeats the request many times.
After many failures, it will 'reset' the WAN interface.
This is just an example.Btw : I use Plus also, 26.07, and pfBlockerNG 3.2.17_1 (with about 100 k DNSBL, not millions) - Python mode as that is the standard.
Kea also.And you know it, we know it, everybody knows it, except your ISP : 900 seconds for an IPv4 renewal is pretty sick. I guess you didn't picked them for that behavior

I consider my '12 hours' on the short side. -
Youâve found the gap in my explanation, thanks. The âsame IP, do nothingâ logic does exist: in pfSense-dhclient-script, a RENEW with an unchanged address leaves changes="no" and rc.newwanip isnât signalled. Mine was signalled on every renewal. rc.newwanip does call system_hosts_generate() unconditionally, but that only matters if it runs, and I hadnât asked why it was running.
It wasnât retries. The log shows one DHCPREQUEST, a DHCPACK 44 ms later, then RENEW, with no PREINIT or interface reset. It wasnât lease length either: my second WAN on the same box renews every 150 s and never triggered rc.newwanip. And yes, 900 s is short; itâs what the ISP hands out.
The difference was an Alias IPv4 address in my WANâs DHCP client configuration, left over from setting up access to my bridged modemâs management page. In the script, the block that re-adds the alias sets changes="yes" on every renewal, even when nothing has changed, and it logs nothing. So the chain was:
DHCP alias on WAN â rc.newwanip on every renewal (every 900 s) â system_hosts_generate() â Unbound reload â pfBlockerNG Python module reinitialises with about 5.9M domains â about 7 s with no DNS answers and an emptied cache.
My second WAN also has an extra address, but as a Firewall Virtual IP rather than a DHCP alias, and it never triggered this. Modem access already ran through a separate Virtual IP on the WAN, so the alias wasnât needed.
Test: I cleared the alias at 14:44. rc.newwanip ran once for that Apply, and has not run on the [N] renewals since ([times]). The filter reloads stopped with it.
Please disregard the unbound.inc patch I posted earlier: it only hid a symptom, and removing the alias looks like the real fix. Itâs still applied here, so I canât yet say Unbound stays quiet without it. Iâll revert it and confirm.
Your system behaves correctly because, Iâd guess, you have no DHCP alias on WAN. Can you confirm? Anyone wanting to reproduce this can set one on a DHCP WAN and watch for rc.newwanip at each renewal.
I think this is a small bug in the script: re-adding an unchanged alias shouldnât count as a change. Iâll open a Redmine report unless someone knows of an existing one.
-
Thanks for the feedback.
you have no DHCP alias on WAN. Can you confirm?
What is a "DHCP alias on WAN" ?
My pfSense WAN gets an RFC1918 from my upstream ISP router (192.168.10.4 - gateway ISP router 192.168.10.1).
My 'real' WAN IP, the one my ISP router gets, is semi static, as a company I can have a IPv4 that 'never' changes.
I do use a DDNS setup so I have a host name avaible that points to this WAN IPv4, so I can reach my pfSense network with VPN.pfBlockerNG Python module reinitialises with about 5.9M domains
Be ware : most of these "5.9 M" listed host names (DNSBL) don't probably exist anymore. All it does is making unbound restart slower every time ... so it's a trade off.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better đ
Register LoginPrivacy Policy · Cookie Policy