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 [2021/03/04 14:10] – [DoT provider] optimize terminology 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> |
| - | + | ||
| - | /* | + | |
| - | This article is a simple how-to to enable DoT with Unbound. | + | |
| - | It should work with just copy-paste on the current OpenWrt stable release out of the box for most users. | + | |
| - | So let's leave advanced zone management, split DNS, manual config edits, etc. outside of the scope of this how-to to minimize the probability of mistakes and simplify the wiki maintenance. | + | |
| - | The link to the main Unbound article [[docs: | + | |
| - | */ | + | |
| ===== Introduction ===== | ===== Introduction ===== | ||
| Line 17: | Line 10: | ||
| {{section> | {{section> | ||
| - | ===== Instructions | + | ===== Command-line instructions |
| [[docs: | [[docs: | ||
| - | Install the packages | + | Install the required |
| + | Enable | ||
| <code bash> | <code bash> | ||
| # Install packages | # Install packages | ||
| opkg update | opkg update | ||
| - | opkg install unbound-daemon | + | opkg install unbound-daemon |
| # Enable DNS encryption | # Enable DNS encryption | ||
| - | while uci -q delete unbound.@zone[0]; | + | uci set unbound.fwd_google.enabled=" |
| - | uci set unbound.forward=" | + | uci set unbound.fwd_google.fallback=" |
| - | uci set unbound.forward.enabled=" | + | |
| - | uci set unbound.forward.fallback=" | + | |
| - | uci set unbound.forward.zone_type=" | + | |
| - | uci set unbound.forward.tls_upstream=" | + | |
| - | uci set unbound.forward.tls_index=" | + | |
| - | uci add_list unbound.forward.zone_name=" | + | |
| - | uci add_list unbound.forward.server=" | + | |
| - | uci add_list unbound.forward.server=" | + | |
| - | uci add_list unbound.forward.server=" | + | |
| - | uci add_list unbound.forward.server=" | + | |
| uci commit unbound | uci commit unbound | ||
| - | / | + | service |
| </ | </ | ||
| Line 54: | Line 38: | ||
| <code bash> | <code bash> | ||
| # Restart services | # Restart services | ||
| - | / | + | service |
| # Log and status | # Log and status | ||
| Line 66: | Line 50: | ||
| uci show unbound | uci show unbound | ||
| </ | </ | ||
| - | |||
| - | [[https:// | ||
| ===== Extras ===== | ===== Extras ===== | ||
| ==== Web interface ==== | ==== Web interface ==== | ||
| - | Install the necessary packages if you want to manage the settings using web interface. | + | If you want to manage the settings using web interface. |
| + | Install the necessary packages. | ||
| <code bash> | <code bash> | ||
| Line 77: | Line 60: | ||
| opkg update | opkg update | ||
| opkg install luci-app-unbound | opkg install luci-app-unbound | ||
| - | / | + | service |
| </ | </ | ||
| - | Navigate to **[[http:// | + | Navigate to **LuCI -> Services -> Recursive DNS** to configure Unbound. |
| ==== DoT provider ==== | ==== DoT provider ==== | ||
| Unbound is configured with Google DNS. | Unbound is configured with Google DNS. | ||
| - | You can change it Cloudflare DNS or any other [[wp> | + | You can change it to Cloudflare DNS or any other [[wp> |
| - | Make sure the resolvers | + | Use resolvers |
| Specify several resolvers to improve fault tolerance. | Specify several resolvers to improve fault tolerance. | ||
| + | Change to Cloudflare DNS | ||
| <code bash> | <code bash> | ||
| # Configure DoT provider | # Configure DoT provider | ||
| - | uci set unbound.forward.tls_index="cloudflare-dns.com" | + | uci set unbound.fwd_google.enabled="0" |
| - | uci -q delete | + | uci set unbound.fwd_cloudflare.enabled=" |
| - | uci add_list unbound.forward.server=" | + | uci set unbound.fwd_cloudflare.fallback=" |
| - | uci add_list unbound.forward.server=" | + | |
| - | uci add_list unbound.forward.server="1.1.1.1" | + | |
| - | uci add_list | + | |
| uci commit unbound | uci commit unbound | ||
| - | /etc/init.d/unbound restart | + | service unbound restart |
| + | </code> | ||
| + | |||
| + | Change to other [[wp> | ||
| + | <code bash> | ||
| + | # Configure DoT provider (example: " | ||
| + | uci set unbound.fwd_google.enabled=" | ||
| + | uci set unbound.fwd_cloudflare.enabled=" | ||
| + | while uci -q del unbound.@zone[4]; | ||
| + | uci add unbound zone | ||
| + | uci set unbound.@zone[-1].enabled=" | ||
| + | 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=" | ||
| + | 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 | ||
| </ | </ | ||
| Line 108: | 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 | ||
| + | </ | ||