# Unbound with libevent no effect?



## wanttotree (Mar 17, 2019)

Hi, i tried to setup local_unbound to have higher outgoing-range. Maybe around 4096-8192. And i want it to be threaded at 4 threads.

It failed to load the settings with anything higher than 950, so i followed how to optimise unbound page on unbound.net.
It all came out with this:
local-unbound[9757:0] warning: too many file descriptors requested. The builtinmini-event cannot handle more than 1024. Config for less fds or compile with libevent
[1552854016] local-unbound[9757:0] warning: continuing with less udp ports: 91
Waiting for nameserver to start... good

Unbound works fine but a bit slow because of the low udp ports per thread. I tried all version including the pre-installed one at version 1.8.1. I also tried installing version 1.9.1 using ./configure --with-libevent && make && make install. Tried multiple times and it seems to install fine but still have the same "too many file descriptors" problem.

I also tried forked operation by doing this :
./configure --without-pthreads--without-solaris-threads && make && make install. Also installs fine, but have the same too many file descriptors problem. 

Maybe i didnt use libevent properly. Help me please. Thanks.


----------



## SirDice (Mar 18, 2019)

Don't build from source, use the package: dns/unbound; LIBEVENT is on by default. And don't confuse the port version with the one from the base OS.


----------



## wanttotree (Mar 18, 2019)

wow! i never seen anything like that. Its all automated! clean and the most beautiful thing ive seen so far! Thanx for pointing it out to me. Cheers


----------



## SirDice (Mar 18, 2019)

wanttotree said:


> Wow! I never seen anything like that. It's all automated! Clean and the most beautiful thing I've seen so far!


The ports system is one of the biggest reasons why I fell in love with FreeBSD almost 20 years ago. 

In this case however there's no need to build from ports, just use the package; `pkg install unbound`. The LIBEVENT option is turned on by default so the package will have this feature enabled. You should only build things from ports if you want/need to deviate from the defaults (different options, different versions, etc.).

The local_unbound is part of the base OS. Which works fine for most generic tasks. You can't change any of the features though, if you need more you're probably better off with the package/port version of unbound.


----------



## wanttotree (Mar 18, 2019)

I did try pkg install unbound. In fact that was the one i use since i installed freebsd in my vm a couple of months ago. Not only it has older version (1.8.3), it also suffer too many file descriptors problem too. Thanx again for this, it made my day.


----------



## wanttotree (Mar 18, 2019)

okay now i finally understand it. All these while i was getting the file descriptor error from local_unbound! silly me. now i have commented out 'local_unbound_enable=YES' in /etc/rc.conf. But how do i get the ports/pkg unbound to run automatically every boot?


----------



## suntzu00 (Mar 19, 2019)

```
unbound_enable=${unbound_enable:-"NO"}
unbound_anchorflags=${unbound_anchorflags:-""}
unbound_conf=${unbound_conf:-"/usr/local/etc/unbound/unbound.conf"}
unbound_flags=${unbound_flags:-" -c ${unbound_conf}"}
```

so unbound_enable="YES" would do the trick


----------



## wanttotree (Mar 19, 2019)

suntzu00 said:


> ```
> unbound_enable=${unbound_enable:-"NO"}
> unbound_anchorflags=${unbound_anchorflags:-""}
> unbound_conf=${unbound_conf:-"/usr/local/etc/unbound/unbound.conf"}
> ...


Thank you suntzu00, i can't believe how simple that is. I feel super dumb rn. U guys rock! SirDice


----------

