Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision Next revisionBoth sides next revision | ||
| docs:guide-user:services:dns:dot_unbound [2019/09/17 22:33] – added extras vgaetera | docs:guide-user:services:dns:dot_unbound [2024/10/21 08:10] – Add chapter how to configure unbound with dnsmasq dpawlik | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== | + | ====== |
| - | {{section> | + | {{section> |
| ===== Introduction ===== | ===== Introduction ===== | ||
| - | * This guide describes | + | * This how-to describes the method for setting up [[wp> |
| - | * It utilizes | + | * It relies on [[docs: |
| - | * DNS encryption is limited | + | * Follow [[docs: |
| ===== Goals ===== | ===== Goals ===== | ||
| {{section> | {{section> | ||
| - | ===== Instructions | + | ===== Command-line instructions |
| - | This method utilizes DoT via [[docs: | + | |
| - | + | ||
| - | Encrypt both LAN client and local system DNS traffic. | + | |
| [[docs: | [[docs: | ||
| - | Use Unbound to encrypt DNS traffic. | + | Install the required packages. |
| - | Override | + | Enable |
| <code bash> | <code bash> | ||
| # Install packages | # Install packages | ||
| opkg update | opkg update | ||
| - | opkg install unbound | + | opkg install unbound-daemon |
| # Enable DNS encryption | # Enable DNS encryption | ||
| - | sed -i -e "/^[^#]/d" | + | uci set unbound.fwd_google.enabled="1" |
| - | cat << EOF >> /etc/unbound/ | + | uci set unbound.fwd_google.fallback="0" |
| - | server: | + | uci commit unbound |
| - | tls-cert-bundle: | + | service |
| - | forward-zone: | + | |
| - | name: "." | + | |
| - | | + | |
| - | | + | |
| - | forward-addr: | + | |
| - | forward-addr: | + | |
| - | forward-addr: | + | |
| - | EOF | + | |
| - | / | + | |
| </ | </ | ||
| - | See also: | + | LAN clients and local system should use Unbound as a primary resolver assuming that Dnsmasq is disabled. |
| - | [[docs: | + | |
| - | [[docs: | + | |
| ===== Testing ===== | ===== Testing ===== | ||
| Line 51: | Line 37: | ||
| <code bash> | <code bash> | ||
| - | # Restart | + | # Restart services |
| - | / | + | service |
| # Log and status | # Log and status | ||
| Line 59: | Line 45: | ||
| # Runtime configuration | # Runtime configuration | ||
| pgrep -f -a unbound | pgrep -f -a unbound | ||
| + | head -v -n -0 / | ||
| # Persistent configuration | # Persistent configuration | ||
| uci show unbound | uci show unbound | ||
| - | grep -v -e " | ||
| </ | </ | ||
| ===== Extras ===== | ===== Extras ===== | ||
| + | ==== Web interface ==== | ||
| + | If you want to manage the settings using web interface. | ||
| + | Install the necessary packages. | ||
| + | |||
| + | <code bash> | ||
| + | # Install packages | ||
| + | opkg update | ||
| + | opkg install luci-app-unbound | ||
| + | service rpcd restart | ||
| + | </ | ||
| + | |||
| + | Navigate to **LuCI -> Services -> Recursive DNS** to configure Unbound. | ||
| + | |||
| ==== DoT provider ==== | ==== DoT provider ==== | ||
| - | Unbound is configured with Google DNS by default. | + | Unbound is configured with Google DNS. |
| - | You can change it to another | + | You can change it to Cloudflare DNS or any other [[wp> |
| - | Make sure selected provider supports | + | Use resolvers supporting |
| - | Specify several | + | Specify several |
| + | Change to Cloudflare DNS | ||
| <code bash> | <code bash> | ||
| # Configure DoT provider | # Configure DoT provider | ||
| - | sed -i -e "/^[^#]/d" | + | uci set unbound.fwd_google.enabled="0" |
| - | cat << EOF >> | + | uci set unbound.fwd_cloudflare.enabled=" |
| - | server: | + | uci set unbound.fwd_cloudflare.fallback=" |
| - | tls-cert-bundle: "/ | + | uci commit unbound |
| - | forward-zone: | + | service unbound restart |
| - | | + | </code> |
| - | | + | |
| - | | + | Change to other [[wp>Public_recursive_name_server|DoT provider]] |
| - | forward-addr: | + | <code bash> |
| - | forward-addr: | + | # Configure DoT provider (example: " |
| - | forward-addr: | + | uci set unbound.fwd_google.enabled=" |
| - | EOF | + | uci set unbound.fwd_cloudflare.enabled=" |
| - | / | + | while uci -q del unbound.@zone[4]; |
| + | uci add unbound zone | ||
| + | uci set unbound.@zone[-1].enabled="1" | ||
| + | uci set unbound.@zone[-1].fallback=" | ||
| + | uci set unbound.@zone[-1].zone_type=" | ||
| + | uci add_list unbound.@zone[-1].zone_name=" | ||
| + | uci add_list unbound.@zone[-1].server="1.1.1.3" | ||
| + | uci add_list unbound.@zone[-1].server=" | ||
| + | uci add_list unbound.@zone[-1].server=" | ||
| + | uci add_list unbound.@zone[-1].server=" | ||
| + | uci set unbound.@zone[-1].tls_upstream=" | ||
| + | uci set unbound.@zone[-1].tls_index=" | ||
| + | uci commit unbound | ||
| + | service | ||
| </ | </ | ||
| ==== DNSSEC validation ==== | ==== DNSSEC validation ==== | ||
| Enforce [[wp> | Enforce [[wp> | ||
| - | Beware of performance issues. | + | Beware of fault tolerance and performance issues. |
| <code bash> | <code bash> | ||
| Line 97: | Line 110: | ||
| uci set unbound.@unbound[0].validator=" | uci set unbound.@unbound[0].validator=" | ||
| uci commit unbound | uci commit unbound | ||
| - | / | + | service |
| </ | </ | ||
| + | |||
| + | ===== Configure unbound with dnsmasq ===== | ||
| + | Unbound can also act as a resolver for dnsmasq. How to install and how to change the [[wp> | ||
| + | Here would be just described how to configure unbound with dnsmasq. | ||
| + | |||
| + | === Command-line instructions === | ||
| + | |||
| + | <code bash> | ||
| + | # Change unbound port to 5353, because dnsmasq is running already on port 53 | ||
| + | sed -i " | ||
| + | |||
| + | # configure dnsmasq to forward to localhost 5353 | ||
| + | service dnsmasq stop | ||
| + | uci set dhcp.@dnsmasq[0].noresolv=" | ||
| + | uci set dhcp.@dnsmasq[0].localuse=" | ||
| + | uci set dhcp.@dnsmasq[0].cachesize=' | ||
| + | uci -q delete dhcp.@dnsmasq[0].server | ||
| + | uci add_list dhcp.@dnsmasq[0].server=" | ||
| + | uci commit dhcp | ||
| + | service dnsmasq start | ||
| + | service unbound restart | ||
| + | |||
| + | # Optional - ensure, that the NTP server can work without DNS | ||
| + | uci del system.ntp.server | ||
| + | uci add_list system.ntp.server=' | ||
| + | uci add_list system.ntp.server=' | ||
| + | uci add_list system.ntp.server=' | ||
| + | uci add_list system.ntp.server=' | ||
| + | uci commit system | ||
| + | </ | ||