Comments on How to Set Up Local DNS Resolver with Unbound on Ubuntu 22.04

Unbound is free and open-source DNS server software that can be used for validating, recursive, and caching DNS resolvers. In this tutorial, you will install Unbound on Ubuntu 22.04 server and set it up as a Local DNS Server with some features enabled, such as DNSSEC, DNS cache, local domain names and sub-domains, and also DNS-over-TLS (DoT).

3 Comment(s)

Add comment

Please register in our forum first to comment.

Comments

By: ustoopia

Great guide. Thanks for putting it together.All seems to work fine, except for one thing. I'm sure I'll find out eventually what the issue is, but so far I'm clueless. The logging doesn't seem to work for me.

By: ustoopia

Ok I figured it out. I had to perform these commands for logging to work:

touch /var/log/unbound.log chown unbound:unbound /var/log/unbound.log

 

By: ustoopia

Final update and solution to what I said earlier:

My previous mentioned solution was actually not the thing that fixed the issue. I changed the owner of the log file like so: chown root:adm /var/log/unbound.log

What actually did cause my issue is that I did not copy the command provided on this page for creating the /etc/rsyslog.d/unbound.conf correctly. I noticed that this part:

if $programname == 'unbound' then /var/log/unbound.log

did not get completely copied over to the conf file. My config file looked like this: if == 'unbound' then /var/log/unbound.log. As you can see it misses: $programname

after I added the $programname part, and restarted the rsyslog service and unbound, all was working as expected. I have no idea what exactly went wrong when I used the command from this tutorial. I simply copied it from this page, and pasted it directly into putty. I suspect the $ is to blame, but I'm too big of an idiot te be sure. After I created the conf file, I did actually check if the file was created, and I even glanced over its content quickly, but I simply overlooked that a part was missing from it. An easy to make mistake.

So, if anybody else has trouble getting the logging to work, inspect the rsyslog config file I mentioned, and make sure the line looks exactly like the one above. Could save you some time :-)