Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jianershi/unbound-config

run unbound dns with grafana dashboard on raspberry pi
https://github.com/jianershi/unbound-config

dashboard dns grafana prometheus raspbeerypi raspberry-pi stats unbound unbound-dns

Last synced: about 2 months ago
JSON representation

run unbound dns with grafana dashboard on raspberry pi

Awesome Lists containing this project

README

        

this repo is no longer maintained.

currently I am using the docker version only.
* https://github.com/jianershi/docker-unbound-grafana

# Unbound Config

config files for unbound recursive dns and a dashboard config based on grafana, runnable on pi

![screenshot](screenshot.png)

## Steps

The following steps have been tested to be working on [**Ubuntu** Server 20.04.2 LTS](https://ubuntu.com/download/raspberry-pi) for Raspberry Pi 2. Newer versions of hardware should work as well.

1. install and config unbound, including setup new control certificate for the server (needed when exporting the stats with unbound_exporter)

```
sudo apt-get install unbound
sudo curl -o /var/lib/unbound/root.hints https://www.internic.net/domain/named.cache
sudo cp unbound.conf /etc/unbound/unbound.conf.d/
sudo systemctl enable unbound
sudo service unbound restart
```

* guide to configure unbound
* https://calomel.org/unbound_dns.html
* https://nlnetlabs.nl/documentation/unbound/unbound.conf/

* to generate self-signing certificate for unbound control interface if you don't have any under /etc/unbound

````
sudo unbound-control-setup
````

this will generate `unbound_server.pem`, `unbound_server.key`, `unbound_control.pem`, `unbound_control.key`

* to update `root.hint` automatically, edit `/etc/crontab`

```
#unbound update root hint
55 4 * * * root curl -o /var/lib/unbound/root.hints https://www.internic.net/domain/named.cache
```

to learn how to use crontab: [https://crontab guru](https://crontab.guru/#55_4_*_*_*)

2. install Grafana

* https://grafana.com/docs/grafana/latest/installation/debian/

3. install PROMETHEUS

`sudo apt-get install prometheus`

4. compile and install [unbound_exporter](https://github.com/kumina/unbound_exporter), which uses unbound control interface to export stats to a webpage

```
go get github.com/kumina/unbound_exporter
go install github.com/kumina/unbound_exporter
sudo cp go/bin/unbound_exporter /usr/bin
sudo cp go/bin/unbound_exporter /usr/sbin
sudo cp unbound-exporter.service /lib/systemd/system/
sudo systemctl enable unbound-exporter.service
sudo service unbound-exporter restart
```

5. config PROMETHEUS file to use unbound_exporter as a source

* `sudo cp prometheus.yml /etc/prometheus/`

* may/maynot need to enable unbound scrap service in prometheus control panel at `http://pi_address:9090/targets`

6. in grafana(`http://pi_address:3000`): add data source -> prometheus in grafana web panel

url: localhost:9090

7. install unbound panel

1. manage panel->import via panel json
2. copy contents in `grafana.json` over. This panel was modified from [unbound dashboard by svartalf](https://grafana.com/grafana/dashboards/11705)

8. after installation, grafana should be accessed at `http://pi_address:3000`

## Diagram

![diagram](diagram.png)

## Performance

performance over 400Mbps/?Mbps cable connecton

![performance](performance.png)

```
Final benchmark results, sorted by nameserver performance:
(average cached name retrieval speed, fastest to slowest)

192.168. 1. 2 | Min | Avg | Max |Std.Dev|Reliab%|
----------------+-------+-------+-------+-------+-------+
+ Cached Name | 0.000 | 0.000 | 0.002 | 0.000 | 100.0 |
+ Uncached Name | 0.016 | 0.067 | 0.279 | 0.065 | 100.0 |
+ DotCom Lookup | 0.018 | 0.046 | 0.088 | 0.026 | 100.0 |
------+-------+-------+-------+-------+-------+
```