Unbound stats check

Not a problem however I was wondering if unbound-control should show any details as the official guide uses 5335 port. I tried following commands and got no answer however as seen in output below unbound is working fine

pi@dnspi3b1:~ $ **unbound-control status;unbound-control stats;sudo systemctl status unbound**
[1610377864] unbound-control[14479:0] warning: control-enable is 'no' in the config file.
[1610377864] unbound-control[14479:0] error: connect: Connection refused for 127.0.0.1 port 8953
unbound is stopped
[1610377864] unbound-control[14480:0] warning: control-enable is 'no' in the config file.
[1610377864] unbound-control[14480:0] error: connect: Connection refused for 127.0.0.1 port 8953
● unbound.service - Unbound DNS server
   Loaded: loaded (/lib/systemd/system/unbound.service; enabled; vendor preset: enabled)
   Active: active (running) since Sun 2021-01-10 20:03:12 EST; 14h ago
     Docs: man:unbound(8)
  Process: 442 ExecStartPre=/usr/lib/unbound/package-helper chroot_setup (code=exited, status=0/SUCCESS)
  Process: 472 ExecStartPre=/usr/lib/unbound/package-helper root_trust_anchor_update (code=exited, status=0/SUCCESS)
 Main PID: 518 (unbound)
    Tasks: 4 (limit: 2063)
   CGroup: /system.slice/unbound.service
           └─518 /usr/sbin/unbound -d

Jan 10 20:03:10 dnspi3b1 systemd[1]: Starting Unbound DNS server...
Jan 10 20:03:11 dnspi3b1 package-helper[472]: /var/lib/unbound/root.key has content
Jan 10 20:03:11 dnspi3b1 package-helper[472]: success: the anchor is ok
Jan 10 20:03:12 dnspi3b1 unbound[518]: [518:0] notice: init module 0: subnet
Jan 10 20:03:12 dnspi3b1 unbound[518]: [518:0] notice: init module 1: validator
Jan 10 20:03:12 dnspi3b1 unbound[518]: [518:0] notice: init module 2: iterator
Jan 10 20:03:12 dnspi3b1 systemd[1]: Started Unbound DNS server.
Jan 10 20:03:12 dnspi3b1 unbound[518]: [518:0] info: start of service (unbound 1.9.0).
Jan 10 20:03:18 dnspi3b1 unbound[518]: [518:1] info: generate keytag query _ta-4f66. NULL IN
Jan 11 08:02:41 dnspi3b1 unbound[518]: [518:0] info: generate keytag query _ta-4f66. NULL IN

@deHakkelaar - I tried your suggestion and changed verbosity to ‘0’ from ‘1’ and added
remote-control:
control-enable: yes

I removed previous 2 lines and changed verbosity back to ‘1’ and service started without issue. Wonder where things might be falling off?

I get this error

pi@dnspi3b1:~ $ sudo systemctl status unbound.service 
● unbound.service - Unbound DNS server
   Loaded: loaded (/lib/systemd/system/unbound.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Mon 2021-01-11 10:54:56 EST; 18s ago
     Docs: man:unbound(8)
  Process: 16055 ExecStartPre=/usr/lib/unbound/package-helper chroot_setup (code=exited, status=1/FAILURE)
  Process: 16058 ExecStartPre=/usr/lib/unbound/package-helper root_trust_anchor_update (code=exited, status=1/FAILURE)
  Process: 16061 ExecStart=/usr/sbin/unbound -d $DAEMON_OPTS (code=exited, status=1/FAILURE)
 Main PID: 16061 (code=exited, status=1/FAILURE)

Jan 11 10:54:56 dnspi3b1 systemd[1]: unbound.service: Service RestartSec=100ms expired, scheduling restart.
Jan 11 10:54:56 dnspi3b1 systemd[1]: unbound.service: Scheduled restart job, restart counter is at 5.
Jan 11 10:54:56 dnspi3b1 systemd[1]: Stopped Unbound DNS server.
Jan 11 10:54:56 dnspi3b1 systemd[1]: unbound.service: Start request repeated too quickly.
Jan 11 10:54:56 dnspi3b1 systemd[1]: unbound.service: Failed with result 'exit-code'.
Jan 11 10:54:56 dnspi3b1 systemd[1]: Failed to start Unbound DNS server.

More details added:
Config file is as below

server:
    # If no logfile is specified, syslog is used
    # logfile: "/var/log/unbound/unbound.log"
    verbosity: 0

    interface: 127.0.0.1
    port: 5335
    do-ip4: yes
    do-udp: yes
    do-tcp: yes

    # May be set to yes if you have IPv6 connectivity
    do-ip6: no

    # You want to leave this to no unless you have *native* IPv6. With 6to4 and
    # Terredo tunnels your web browser should favor IPv4 for the same reasons
    prefer-ip6: no

    # Use this only when you downloaded the list of primary root servers!
    # If you use the default dns-root-data package, unbound will find it automatically
    #root-hints: "/var/lib/unbound/root.hints"

    # Trust glue only if it is within the server's authority
    harden-glue: yes

    # Require DNSSEC data for trust-anchored zones, if such data is absent, the zone becomes BOGUS
    harden-dnssec-stripped: yes

    # Don't use Capitalization randomization as it known to cause DNSSEC issues sometimes
    # see https://discourse.pi-hole.net/t/unbound-stubby-or-dnscrypt-proxy/9378 for further details
    use-caps-for-id: no

    # Reduce EDNS reassembly buffer size.
    # Suggested by the unbound man page to reduce fragmentation reassembly problems
    edns-buffer-size: 1472

    # Perform prefetching of close to expired message cache entries
    # This only applies to domains that have been frequently queried
    prefetch: yes

    # One thread should be sufficient, can be increased on beefy machines. In reality for most users running on small networks or on a single machine, it should be unnecessary to seek performance enhancement by increasing num-threads above 1.
    num-threads: 1

    # Ensure kernel buffer is large enough to not lose messages in traffic spikes
    so-rcvbuf: 1m

    # Ensure privacy of local IP ranges
    private-address: 192.168.0.0/16
    private-address: 169.254.0.0/16
    private-address: 172.16.0.0/12
    private-address: 10.0.0.0/8
    private-address: fd00::/8
    private-address: fe80::/10

#remote-control:
#    control-enable: yes
pi@dnspi3b1:~ $ unbound-checkconf
unbound-checkconf: no errors in /etc/unbound/unbound.conf

Check if your new config is actually correct. What does unbound-checkconf output?

pi@dnspi3b1:~ $ unbound-checkconf
unbound-checkconf: no errors in /etc/unbound/unbound.conf

I am not too sure of how Linux works or if it even requires a reboot post such configuration change, so I rebooted just to make sure things are normal and it works now.

pi@dnspi3b1:~ $ unbound-checkconf;sudo unbound-control status;sudo systemctl status unbound
unbound-checkconf: no errors in /etc/unbound/unbound.conf
version: 1.9.0
verbosity: 1
threads: 4
modules: 3 [ subnet validator iterator ]
uptime: 463 seconds
options: reuseport control(ssl)
unbound (pid 16920) is running...
● unbound.service - Unbound DNS server
   Loaded: loaded (/lib/systemd/system/unbound.service; enabled; vendor preset: enabled)
   Active: active (running) since Mon 2021-01-11 11:14:53 EST; 7min ago
     Docs: man:unbound(8)
  Process: 16913 ExecStartPre=/usr/lib/unbound/package-helper chroot_setup (code=exited, status=0/SUCCESS)
  Process: 16916 ExecStartPre=/usr/lib/unbound/package-helper root_trust_anchor_update (code=exited, status=0/SUCCESS)
 Main PID: 16920 (unbound)
    Tasks: 4 (limit: 2063)
   CGroup: /system.slice/unbound.service
           └─16920 /usr/sbin/unbound -d

Jan 11 11:14:53 dnspi3b1 systemd[1]: Starting Unbound DNS server...
Jan 11 11:14:53 dnspi3b1 package-helper[16916]: /var/lib/unbound/root.key has content
Jan 11 11:14:53 dnspi3b1 package-helper[16916]: success: the anchor is ok
Jan 11 11:14:53 dnspi3b1 unbound[16920]: [16920:0] notice: init module 0: subnet
Jan 11 11:14:53 dnspi3b1 unbound[16920]: [16920:0] notice: init module 1: validator
Jan 11 11:14:53 dnspi3b1 unbound[16920]: [16920:0] notice: init module 2: iterator
Jan 11 11:14:53 dnspi3b1 unbound[16920]: [16920:0] info: start of service (unbound 1.9.0).
Jan 11 11:14:53 dnspi3b1 systemd[1]: Started Unbound DNS server.
Jan 11 11:15:00 dnspi3b1 unbound[16920]: [16920:0] info: generate keytag query _ta-4f66. NULL IN
pi@dnspi3b1:~ $ sudo netstat -nltup | grep 'Proto\|:8953 '
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 127.0.0.1:8953          0.0.0.0:*               LISTEN      16920/unbound

Moderator note - if you format your text output as pre-formatted text using the </> icon in the reply window, it will be much easier to read. I edited your previous posts.

What is it you are trying to do? Acess the unbound stats?

Once you have unbound control enabled in unbound by putting this in your configuration file:

remote-control:
     control-enable: yes

restart unbound with sudo service unbound restart , then run

sudo unbound-control -c /etc/unbound/unbound.conf stats_noreset

Thanks @deHakkelaar & @jfb

I will keep in mind to use proper syntax - thanks for help

I was reading up much about unbound and thought of seeing the statistics to have to start this thread - now I am able to see them and will need to learn to decipher them. I am in no way going to make many changes so as to deviate from original configuration posted in original document.

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.