OPNsense Forum

Archive => 16.1 Legacy Series => Topic started by: Tikimotel on March 16, 2016, 08:22:09 PM

Title: Unbound host entries generating bug
Post by: Tikimotel on March 16, 2016, 08:22:09 PM
Currently (16.1.7) unbound does not generate the host and domain itself inside the "host_entries.conf" file.
My current work around was setting a host override.

Without it hostname lookups in windows look like so:

nslookup <enter>
Default Server:  Unkown
Address:  192.168.0.1

> Anduril
Server:  Unkown
Address:  192.168.0.1

Name:    Anduril.home
Address:  192.168.0.51

> exit


It was because the "host_entries.conf" only added localhost.
"host_entries.conf"
local-zone: "home" transparent
local-data-ptr: "127.0.0.1 localhost"
local-data: "localhost A 127.0.0.1"
local-data: "localhost.home A 127.0.0.1"
local-data-ptr: "::1 localhost"
local-data: "localhost AAAA ::1"
local-data: "localhost.home AAAA ::1"


To fix this the reference to the 'interface' needs to be changed to 'active_interface'.
Part of "unbound.inc"

519    if (isset($config['unbound']['interface'])) {
520        $interfaces = explode(",", $config['unbound']['interface']);


519    if (isset($config['unbound']['active_interface'])) {
520        $interfaces = explode(",", $config['unbound']['active_interface']);

After saving the config again the "host_entries.conf" does save for LAN interface the hostname of opnsense.
(a bit further in the code "$if" is used a variable for testing real interfaces, reading "if" and "$if" not nice...and should be changed)

local-zone: "home" transparent
local-data-ptr: "127.0.0.1 localhost"
local-data: "localhost A 127.0.0.1"
local-data: "localhost.home A 127.0.0.1"
local-data-ptr: "::1 localhost"
local-data: "localhost AAAA ::1"
local-data: "localhost.home AAAA ::1"
local-data-ptr: "192.168.0.1 OPNsense.home"
local-data: "OPNsense.home A 192.168.0.1"
local-data: "OPNsense A 192.168.0.1"


After this fix hostname lookups in windows look like so:

nslookup <enter>
Default Server:  OPNsense.home
Address:  192.168.0.1

> Anduril
Server:  OPNsense.home
Address:  192.168.0.1

Name:    Anduril.home
Address:  192.168.0.51

> exit

Title: Re: Unbound host entries generating bug
Post by: Tikimotel on March 16, 2016, 09:00:03 PM
It only works for 1 interface at a time.
When selecting LAN and Localhost, the DNS Lookup page won't respond for 127.0.0.1
So when just using/choosing LAN (IPv4) it works fine.
Title: Re: Unbound host entries generating bug
Post by: franco on March 17, 2016, 08:18:14 AM
I'm guessing that's the same issue as reported here: https://github.com/opnsense/core/issues/746#issuecomment-197067451

Not sure how to fix this for all cases yet, but that you for the analysis. That will help. :)
Title: Re: Unbound host entries generating bug
Post by: Tikimotel on March 17, 2016, 05:22:54 PM
Using Localhost (which you can select in the unbound menu options) kind off, needs to be excluded.
You get double 127.0.0.1 entries, and unbound refuses to start. That's why, dns lookups are unresponsive.

I feel you can get away with just the LAN and or the LAN IPv6 Link-Local as options.
But don't know how virtual interfaces would translate, using the current "unbound.inc"