Skip to content

Commit 36497ce

Browse files
authored
Merge pull request #6 from ar51an/1.2
1.2
2 parents b7993fb + 2eae687 commit 36497ce

File tree

3 files changed

+72
-55
lines changed

3 files changed

+72
-55
lines changed

README.md

Lines changed: 44 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -16,57 +16,40 @@
1616
🔸 `Recursive` resolving from the root. **No** forwarding to other resolvers.
1717
🔸 Redis backend database for `persistent` cache. Works as second level cache.
1818
🔸 Network wide `Ads and Trackers` block. **No** pi-hole/adguard. **No** extra hop to resolve DNS.
19-
🔸 Unbound `dashboard` is available at [unbound-dashboard](https://github.com/ar51an/unbound-dashboard). (_Optional_)
19+
🔸 Unbound `dashboard` is available at [unbound-dashboard](https://github.com/ar51an/unbound-dashboard). (_Optional_)
20+
🔸 Refer to `release.md` for changes and update.
2021

2122
#### Prerequisite:
22-
* Unbound compilation and installation is validated on `RaspiOS/Debian`. `Post Install` startup service and scripts are reused from RaspiOS bullseye, they may require modification for other linux distributions.
23+
* Unbound compilation and installation is validated on `RaspberryPi OS/Debian`. `Post Install` startup service and scripts may require modification for other linux distributions.
2324
* If unbound package is installed. Take a backup of current `unbound.conf`. Remove unbound package completely:
2425

2526
> `sudo apt --purge autoremove unbound`
2627
2728
#### Specs:
2829
> |Unbound |OS |HW |
2930
> |:-------|:----------------------------|:-----------------------|
30-
> |`1.17.1`|`raspios-bullseye-arm64-lite`|`Raspberry Pi 4 Model B`|
31+
> |`1.19.0`|`raspios-bookworm-arm64-lite`|`Raspberry Pi 4 Model B`|
3132
3233
#
3334
### Steps
3435
  🔸 Redis ➜ Unbound ➜ Post Install ➜ Config ➜ Timers & Services ➜ Blocklist ➜ Start
3536
#### ❯ Redis
3637
  🔸 Install ➜ Config
3738
* **Install:**
38-
There are 2 options **either** install redis (6.0.16) from RaspiOS bullseye **or** install redis (7.0.*) from RaspiOS bullseye backports.
39-
* Install redis **(6.0.16)** from raspios bullseye:
40-
> `sudo apt install redis-server`
41-
42-
* Install redis **(7.0.*)** from raspios bullseye backports:
43-
> Enable backports. Edit sources list:
44-
> `sudo nano /etc/apt/sources.list`
45-
> Add backports source at the end:
46-
> `deb http://deb.debian.org/debian bullseye-backports main`
47-
48-
> Install redis:
49-
> `sudo apt install redis-server/bullseye-backports`
39+
> `sudo apt install redis-server`
5040
5141
* **Config:**
5242
An optimized `redis.conf` for unbound is available in the release under `config` dir. Default _redis.conf_ from redis **7.0.*** is used as base config for the provided config. Some of the options may not be available or may be different if you are on an earlier version of redis. You can use _redis.conf_ **either** from the release **or** your preferred one.
5343

54-
If you installed redis **7.0.*** and going to use the provided _redis.conf_, below steps can be helpful:
44+
To use the provided _redis.conf_, below steps can be helpful:
5545
> Edit redis config:
5646
> `sudo nano /etc/redis/redis.conf`
5747
> Delete everything in default redis config:
5848
> `Ctrl+6` `Alt+t` `Ctrl+6`
5949
> Copy and paste the provided `redis.conf`. Save and exit nano
6050
6151
> `ℹ️` **Note:**
62-
> Provided `redis.conf` is tweaked after some thorough testing in small network. Like 8mb maxmemory has pretty optimal performance with enough cache and evict least recently used keys. Similarly snapshotting is used to save keys to database, current option will save after 2hrs if atleast 100 new keys were added or after 12hrs if at least 1 new key is added. Reboot will save database as long as snapshotting is enabled. Feel free to change them as preferred.
63-
64-
* **Startup Warning:**
65-
For redis **7.0.*** from `backports`. Modify services to fix journal `⚠️` warning on redis startup.
66-
> Edit: `sudo nano /usr/lib/systemd/system/redis-server.service`
67-
> Edit: `sudo nano /usr/lib/systemd/system/redis-server@.service`
68-
> Remove/Comment lines starting with `NoExecPaths` and `ExecPaths` from both above services
69-
> Restart redis: `sudo systemctl restart redis-server`
52+
> Provided `redis.conf` is tweaked after some thorough testing in small network. Like 4mb maxmemory has pretty optimal performance with enough cache and evict least recently used keys. Similarly snapshotting is used to save keys to database, current option will save after 2hrs if atleast 100 new keys were added or after 12hrs if at least 1 new key is added. Reboot will save database as long as snapshotting is enabled. Feel free to change them as preferred.
7053
7154
<div align="center">
7255
<img src="https://user-images.githubusercontent.com/11185794/205388020-99c057ad-ee9d-440b-8df9-587f5c133f2e.png?raw=true" alt="divider"/>
@@ -81,17 +64,17 @@
8164
> ```
8265
8366
* **Extract:**
84-
[Download](https://github.com/NLnetLabs/unbound/archive/refs/tags/release-1.17.1.tar.gz) and extract unbound.
67+
[Download](https://github.com/NLnetLabs/unbound/archive/refs/tags/release-1.19.0.tar.gz) and extract unbound.
8568
> Extract:
86-
> `tar -xvzf unbound-release-1.17.1.tar.gz`
69+
> `tar -xvzf unbound-release-1.19.0.tar.gz`
8770
8871
* **CFLAGS:**
8972
Remove debugging information, otherwise unbound binary size will be much larger.
9073
> Set CFLAG:
9174
> `export CFLAGS="-O2"`
9275
9376
> `ℹ️` **Note:**
94-
> Unbound `1.17.1` binary size comparison:
77+
> Unbound binary size comparison:
9578
> ![bookworm](https://user-images.githubusercontent.com/11185794/216804507-b019a32f-c0bc-44be-a6f6-23de274c0493.png) &nbsp;➟ _Debian Bookworm Prebuilt_ `Without Cachdb Module`
9679
> ![debug-off](https://user-images.githubusercontent.com/11185794/216804539-a5ebcc20-27d0-4d6f-bf1e-b55c7d064fd0.png) &nbsp;➟ _Compiled Without Debug Info_ `With Cachdb Module`
9780
> ![debug-on](https://user-images.githubusercontent.com/11185794/216804527-fa06ba09-2d51-4662-9fae-2cafa3a30721.png) &nbsp;➟ _Compiled With Debug Info_ `With Cachdb Module`
@@ -118,7 +101,7 @@
118101
> Run: `sudo ./post-install.sh`
119102
120103
> `ℹ️` **Note:**
121-
> Startup service and scripts are reused from unbound package in RaspiOS bullseye. `root.hints` is downloaded from `internic`, it will be automated through systemd timer.
104+
> Startup service and scripts are reused from unbound package in RaspberryPi OS Bookworm. `root.hints` is downloaded from `internic`, it will be automated through systemd timer.
122105
* Alternatively, create user manually and use your preferred startup service and scripts.
123106
124107
<div align="center">
@@ -260,17 +243,46 @@
260243
261244
#
262245
#### ❯ `ℹ️` Tips & Notes
246+
* **Enable Redis Unix Socket:**
247+
Unbound **(1.18.0)** added the option to connect to redis server over unix socket. It has better throughput. Follow below steps to enable unix socket connection between unbound and redis:
248+
* Redis config:
249+
> Edit: `sudo nano /etc/redis/redis.conf`
250+
251+
> Add options:
252+
> `unixsocket /var/run/redis/redis.sock`
253+
> `unixsocketperm 707`
254+
255+
> Restart redis:
256+
> `sudo systemctl restart redis-server`
257+
258+
* Unbound config:
259+
> Edit: `sudo nano /etc/unbound/unbound.conf`
260+
261+
> Modify under **`cachedb:`** tag:
262+
> > Add:
263+
> > `redis-server-path: "/var/run/redis/redis.sock"`
264+
> > Comment out:
265+
> > `#redis-server-host: 127.0.0.1`
266+
> > `#redis-server-port: 6379`
267+
268+
> Restart unbound:
269+
> `sudo systemctl restart unbound`
270+
271+
> `ℹ️` **Note:**
272+
> In order to use more restrictive option `unixsocketperm 770` in `redis.conf`, add unbound user to redis group.
273+
> Redis connectivity on TCP can be turned off with option `port 0` in redis.conf. When redis is not listening on TCP, specify socket path in cli cmds `redis-cli -s /var/run/redis/redis.sock`
274+
263275
* **Resolver Configuration:**
264-
Make sure `/etc/resolv.conf` has only one name server.
265-
> `nameserver <RaspberryPi-IP>` **or** `nameserver 127.0.0.1`
276+
Make sure `/etc/resolv.conf` has only RaspberryPi IP name servers. `NetworkManager` in RaspberryPi OS Bookworm will make this change automatically if your router's LAN DNS is pointing to Raspberry Pi IP.
277+
> `nameserver <RaspberryPi-IP>`
266278
267279
* **Add LAN DNS:**
268280
According to your router, change LAN DNS to Raspberry Pi IP. DNS setting under internet setup is WAN DNS, it is not same as LAN DNS. If router permits to change LAN DNS, it is usually under LAN setup.
269281
270282
* **Troubleshoot Blocked Domain:**
271-
Below configuration logs only blocked domains, using that you can find domain causing the issue.
283+
Below option logs blocked domains, using that you can find domain causing the issue.
272284
> Edit: `sudo nano unbound.conf`
273-
> Set: `verbosity: 1` and `log-local-actions: yes`
285+
> Set: `log-local-actions: yes`
274286
275287
* **Block Selective:**
276288
Specific domains can be blocked for specific IPs with tag options. It works on top of existing ads and trackers block. Provided `unbound.conf` has selective block configuration commented out under `|Block|`. If interested uncomment it and replace the IPs and domains.
@@ -299,7 +311,4 @@
299311
300312
After uninstall all the `Post Install` and `Timers & Services` steps can be easily reverted by running `post-remove.sh` provided in the release.
301313
> `sudo ./post-remove.sh`
302-
303-
* **Update Unbound:**
304-
Refer `UPDATE.md` for updating Unbound.
305314
</div>

UPDATE.md

Lines changed: 0 additions & 20 deletions
This file was deleted.

release.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#### Release Notes:
2+
* **1.2 Release:**
3+
v1.2 release includes RaspberryPi OS Bookworm related scripts and service changes. If you are on Bullseye use v1.1 release.
4+
5+
<div align="center">
6+
<img src="https://user-images.githubusercontent.com/11185794/205388020-99c057ad-ee9d-440b-8df9-587f5c133f2e.png?raw=true" alt="divider"/>
7+
</div>
8+
9+
#### Unbound Updates:
10+
* **Unbound 1.18.0:**
11+
Unbound added the option to connect to redis server over a unix socket. Unix sockets have better throughput. Check
12+
the `Tips & Notes` section in the README for enabling it.
13+
14+
* **Unbound 1.17.1:**
15+
Unbound has a new option to keep cache intact between configuration reloads. It is integrated into blocklist & roothints update.
16+
17+
<div align="center">
18+
<img src="https://user-images.githubusercontent.com/11185794/205388020-99c057ad-ee9d-440b-8df9-587f5c133f2e.png?raw=true" alt="divider"/>
19+
</div>
20+
21+
#### Upgrade:
22+
To upgrade unbound from old-ver to latest-ver. Only below steps are required:
23+
* Unbound ➟ `Download, Extract, CFLAGS, Configure, Compile and Install`
24+
* Restart unbound
25+
26+
<div align="center">
27+
<img src="https://user-images.githubusercontent.com/11185794/205388020-99c057ad-ee9d-440b-8df9-587f5c133f2e.png?raw=true" alt="divider"/>
28+
</div>

0 commit comments

Comments
 (0)