Project

General

Profile

Actions

Bug #13707

open

Unbound not binding to LAN on startup when explicitly set

Added by Simon Byrnand about 2 years ago. Updated about 1 year ago.

Status:
New
Priority:
Low
Assignee:
-
Category:
DNS Resolver
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Plus Target Version:
Release Notes:
Default
Affected Version:
2.6.0
Affected Architecture:
amd64

Description

Hi,

This is related to the following forum thread:

https://forum.netgate.com/topic/176155/unbound-not-responding-on-all-chosen-interfaces-after-reboot

To summarise the thread, if I configure unbound to bind to only Localhost and the LAN interface, on restart it does not bind to the LAN, so will not respond to queries from the LAN. If I restart the service manually it starts working, and binding to "All" is a workaround. On different hardware which I have tried, the problem does not occur so this seems to be triggered by specific timing relationship between the startup scripts and the ethernet links going up during boot. In other words a race condition.

I note from the system.log that the unbound service starts after igb0 (WAN) goes up, but before igb1 (LAN) goes up, and there is no attempt to restart unbound anywhere in the log after the LAN interface goes up:

Nov 29 09:18:48 pfSense-Home check_reload_status409: Linkup starting igb0
Nov 29 09:18:48 pfSense-Home kernel:
Nov 29 09:18:48 pfSense-Home kernel: igb0: link state changed to UP
Nov 29 09:18:48 pfSense-Home check_reload_status409: rc.newwanip starting igb0
Nov 29 09:18:48 pfSense-Home php431: rc.bootup: Resyncing OpenVPN instances.
Nov 29 09:18:48 pfSense-Home kernel: done.
Nov 29 09:18:48 pfSense-Home php431: rc.bootup: [squid] Installed but disabled. Not installing 'nat' rules.
Nov 29 09:18:48 pfSense-Home kernel: pflog0: promiscuous mode enabled
Nov 29 09:18:48 pfSense-Home php431: rc.bootup: [squid] Installed but disabled. Not installing 'pfearly' rules.
Nov 29 09:18:48 pfSense-Home kernel: .
Nov 29 09:18:48 pfSense-Home php431: rc.bootup: [squid] Installed but disabled. Not installing 'filter' rules.
Nov 29 09:18:48 pfSense-Home kernel: ..
Nov 29 09:18:48 pfSense-Home kernel: .done.
Nov 29 09:18:49 pfSense-Home php431: rc.bootup: Default gateway setting Interface WAN_DHCP Gateway as default.
Nov 29 09:18:49 pfSense-Home php431: rc.bootup: Gateway, none 'available' for inet6, use the first one configured. ''
Nov 29 09:18:49 pfSense-Home kernel: done.
Nov 29 09:18:49 pfSense-Home php-fpm371: /rc.newwanip: rc.newwanip: Info: starting on igb0.
Nov 29 09:18:49 pfSense-Home php-fpm371: /rc.newwanip: rc.newwanip: on (IP address: x.x.x.x) (interface: WAN[wan]) (real interface: igb0).
Nov 29 09:18:50 pfSense-Home php431: rc.bootup: sync unbound done.
Nov 29 09:18:50 pfSense-Home kernel: done.
Nov 29 09:18:50 pfSense-Home kernel: done.
Nov 29 09:18:53 pfSense-Home check_reload_status409: Linkup starting igb1
Nov 29 09:18:53 pfSense-Home kernel:
Nov 29 09:18:53 pfSense-Home kernel: igb1: link state changed to UP

In the unbound config file the LAN interface IP is missing but it is there after the service is manually restarted. Presumably the script which generated the config file saw the LAN interface was down at the time it first launched unbound and did not include it.

I have been down the rabbit hole of studying redmine tickets 12613, 13254 and several other related tickets, however they relate to different versions which have different code for rc.linkup than 2.6.0, and I also see there is a significant rewrite of this code underway for 2.7.0.

When I look at the code for rc.linkup shipped in 2.6.0 I can clearly see there is code intended to restart unbound when an interface goes up, however this does not seem to trigger when the interface goes up during initial bootup, as a result after a full reboot or cold boot it does not bind to the LAN interface. It does work after a "reroot reboot" presumably because the interface remains up the whole time.


Files

PFSense-2.7.0-error.png (3.58 MB) PFSense-2.7.0-error.png Simon Byrnand, 12/03/2022 11:52 AM
clipboard-202212031920-ksvxu.png (16.8 KB) clipboard-202212031920-ksvxu.png interfaces_unbound_pfStartup Jordan G, 12/03/2022 07:20 PM
boot-sequence.png (911 KB) boot-sequence.png screenshot of boot sequence Simon Byrnand, 12/05/2022 02:12 PM
Actions

Also available in: Atom PDF