OPNsense Forum

Archive => 21.7 Legacy Series => Topic started by: janci on September 28, 2021, 07:20:16 AM

Title: Unbound is not registering new DHPC lease
Post by: janci on September 28, 2021, 07:20:16 AM
I did buy new pizero, configured it and connect to my VLAN.

I am not able to ping it using its name. e.g. ping pizero7 But I can see it in DHCPv4 -> leases list and can ping its IP. I am also able to ping another devices in that VLAN using their names, e.g.  ping pizero3.

I did switch off pizero3 and pizero7 for while so lease will expire. Then I did switch them on. I can ping pizero3 using its name but not pizero7. Only difference between those two devices is that pizero3 is connected to network for long time and pizero7 is new and this is first time it is connected to network.

On my linux laptop I am checking nslookup pizero3 and getting correct answert from OP. Checking pizero7 with nslookup I am getting NXDOMAIN

NOTE:
I am also running dnscrypt on OP and I did configured unbound to forward DNS query to dnscrypt.
see my comment https://forum.opnsense.org/index.php?topic=10670.msg118634#msg118634 (https://forum.opnsense.org/index.php?topic=10670.msg118634#msg118634)


Thanks for any help and tip ...
Title: Re: Unbound is not registering new DHPC lease
Post by: chemlud on September 28, 2021, 09:46:21 AM
Is it pi zero wifi? Which wifi AP do you use?  Or do you use usb-RJ45 adapters?
Title: Re: Unbound is not registering new DHPC lease
Post by: janci on September 28, 2021, 09:02:04 PM
yes, it is pizero with wifi and I am using ubiquiti AP-AC-LR.
but as I did write, I can ping IP and I did test connetion for both pizeros and looks OK
Title: Re: Unbound is not registering new DHPC lease
Post by: janci on September 28, 2021, 10:18:45 PM
ok, I did try usb ethernet adapter to connect pizero to network, problem remain ...
so I think it is not problem of wifi AP
Title: Re: Unbound is not registering new DHPC lease
Post by: janci on September 29, 2021, 05:31:01 PM
I think it is a bug.

After new device is connected to network, it is geting IP and I can see it in DHCPv4 leases list.
But file /var/unbound/dhcpleases.conf is not updated and that new device is not in it.

edit:
I did change existing and working device to static IP. Dhcp service was restarted and I did reconnect device.
I can see it in /var/unbound/host_entries.conf but file /var/unbound/dhcpleases.conf is again not updated
Title: Re: Unbound is not registering new DHPC lease
Post by: Fright on September 29, 2021, 09:17:04 PM
@janci
is "DHCP Registration" checkbox enabled in Unbound?
is unbound_dhcpd.py process running?
QuoteI can see it in /var/unbound/host_entries.conf but file /var/unbound/dhcpleases.conf is again not updated

static dhcp entries goes to host_entries.conf. dynamic - to dhcpleases.conf
Title: Re: Unbound is not registering new DHPC lease
Post by: janci on September 30, 2021, 07:06:54 AM
yes, both checkboxes  "Register DHCP leases" and "Register DHCP static mappings" are checked.

I did run this:
sudo ps -aux|grep unbound

and output is
/usr/local/sbin/unbound -c /var/unbound/unbound.conf

so unbound_dhcpd.py is not running
I am trying to findout the reason why it is crash to start but dont know which log file to check
Title: Re: Unbound is not registering new DHPC lease
Post by: Fright on September 30, 2021, 08:50:04 AM
Quotesudo ps -aux|grep unbound
sudo ps -auxww | grep _dhcpd.py
or just System: Diagnostics: Activity
if it's not there, can try to restart unbound
Title: Re: Unbound is not registering new DHPC lease
Post by: janci on September 30, 2021, 09:12:38 AM
it is definitly not running
I did restart unbound, but not help.
While restarting I did see (run quickly ps ...) that it was starting ...
Title: Re: Unbound is not registering new DHPC lease
Post by: Fright on September 30, 2021, 10:06:11 AM
any error if you run
/usr/local/opnsense/scripts/dns/unbound_dhcpd.py --domain localdomain
in shell?
Title: Re: Unbound is not registering new DHPC lease
Post by: franco on September 30, 2021, 10:39:17 AM
Can we get some sort of version number for baselining please...
Title: Re: Unbound is not registering new DHPC lease
Post by: janci on September 30, 2021, 01:11:01 PM
#1
starting unbound_dhcpd.py from console as standart user failed with message "Unable to create the pidfile."
starting unbound_dhcpd.py from console as root (using sudo) started ok, and resolving is working ok too.

#2 OPNsense 21.7.3_1-amd64
and just check for updates and it is up to date
Title: Re: Unbound is not registering new DHPC lease
Post by: Fright on September 30, 2021, 05:45:28 PM
sorry, did not fully understand. when you start the unbound_dhcpd.py manually, client names are resolved and dynamic client records appear in dhcpleases.conf ?
Title: Re: Unbound is not registering new DHPC lease
Post by: janci on September 30, 2021, 06:52:11 PM
I am ssh to router as standart user (not root).

so, when I did run unbound_dhcpd.py it said "Unable to create the pidfile."

BUT

if I did run sudo unbound_dhcpd.py then it is ok
Title: Re: Unbound is not registering new DHPC lease
Post by: Fright on September 30, 2021, 07:50:00 PM
yes, I understood this part)  but do the required entries appear in unbound after that?
Title: Re: Unbound is not registering new DHPC lease
Post by: janci on September 30, 2021, 08:30:56 PM
yes, /var/unbound/dhcpleases.conf is updated after new device apears
Title: Re: Unbound is not registering new DHPC lease
Post by: Fright on September 30, 2021, 09:06:36 PM
got it, thanks. so the problem is dhcpd watcher is not kept working after unbound start?
will try to reproduce
Title: Re: Unbound is not registering new DHPC lease
Post by: janci on November 20, 2021, 08:53:54 AM
I did update my router to OPNsense 21.7.5-amd64 today.
BUT /usr/local/opnsense/scripts/dns/unbound_dhcpd.py did not start so I did start it manualy.

do you have some news / progress on this? should I write a bug ?

thanks
Title: Re: Unbound is not registering new DHPC lease
Post by: Fright on November 20, 2021, 10:21:27 AM
hi
did "daemonize unbound dhcpd watcher" string appeared in unbound log? (is it started and crashed or didnt start at all)
Title: Re: Unbound is not registering new DHPC lease
Post by: janci on December 20, 2021, 08:35:22 PM
sorry, Meanwhile I did update to 21.7.7-amd64 and unbound_dhcpd.py did not start.

which log file should I look at?
it is bit conusing for me, I am not able to find correct log file in web gui.
and on console I am not sure too.

edit:
1) I did got to Services -> Unbound DNS -> Log file
2) search for "watcher"
3) I can see that "daemonize unbound dhcpd watcher" string did appear in log cca at time when I was updating.
4) but I did remember that I did log into router over ssh and check if it is running and wasn't
Title: Re: Unbound is not registering new DHPC lease
Post by: janci on February 15, 2022, 09:03:02 PM
just updating
I did update to 22.1. and problem remain, so if I change configuration of unbound it will restart but watcher is not running so I have to start it manually.