|
2 | 2 |
|
3 | 3 | This article describes how to configure and use Unbound on OpenBSD in order to send encrypted DNS via DNS over TLS to Quad9.
|
4 | 4 |
|
5 |
| -This was tested using OpenBSD 7.1. |
| 5 | +This was tested using OpenBSD 7.7. |
6 | 6 |
|
7 | 7 | !!! warning "Firefox, VPNs"
|
8 | 8 | * **Firefox** is set to use Cloudflare DNS by default in some regions. If you're using Firefox, check that [this is disabled](https://support.mozilla.org/en-US/kb/dns-over-https#w_configure-doh-protection-settings).
|
@@ -42,47 +42,38 @@ forward-addr: 2620:fe::fe@853#dns.quad9.net
|
42 | 42 | forward-addr: 2620:fe::9@853#dns.quad9.net
|
43 | 43 | ```
|
44 | 44 |
|
45 |
| -* Set Unbound to start on system startup, and enable the service (run these commands one at a time): |
| 45 | +* Set Unbound to start on system startup, and start the service: |
46 | 46 |
|
47 | 47 | ```
|
48 |
| -rcctl enable unbound |
49 |
| -``` |
50 |
| -``` |
51 |
| -rcctl start unbound |
| 48 | +rcctl enable unbound && rcctl start unbound |
52 | 49 | ```
|
53 | 50 |
|
54 |
| -## Verify Configuration |
| 51 | +* Disable resolvd to prevent automatically overriding the `/etc/resolv.conf` file: |
55 | 52 |
|
56 |
| -Open a separate/second Terminal session to the OpenBSD system as the root user and start a packet capture, filtering for port 853 (DNS over TLS port): |
57 |
| -tcpdump -n 'port 853' |
58 |
| - |
59 |
| -* On your first Terminal session, make sure Unbound can answer DNS queries: |
60 |
| -dig +short quad9.net @127.0.0.1 |
| 53 | +``` |
| 54 | +rcctl disable resolvd && rcctl stop resolvd |
| 55 | +``` |
61 | 56 |
|
62 |
| -The result should be: 216.21.3.77 |
| 57 | +* Set your system to start using Unbound for DNS by backing up the existing resolv.conf file and set 127.0.0.1 as the DNS server for the system: |
63 | 58 |
|
64 |
| -On your second Terminal session, tcpdump should show output like this, which confirms that the DNS query was sent to Quad9 with DNS over TLS: |
65 | 59 | ```
|
66 |
| -tcpdump: listening on em0, link-type EN10MB |
67 |
| -00:29:08.307240 192.168.1.194.42064 > 149.112.112.112.853: S 3620809840:3620809840(0) win 16384 <mss 1460,nop,nop,sackOK,nop,wscale 6,nop,nop,timestamp 495425124 0> (DF) |
68 |
| -00:29:08.313467 149.112.112.112.853 > 192.168.1.194.42064: S 1684627303:1684627303(0) ack 3620809841 win 28960 <mss 1460,nop,nop,timestamp 3541989193 495425124,nop,wscale 8> (DF) |
69 |
| -00:29:08.313559 192.168.1.194.42064 > 149.112.112.112.853: . ack 1 win 256 <nop,nop,timestamp 495425124 3541989193> (DF) |
70 |
| -00:29:08.313895 192.168.1.194.42064 > 149.112.112.112.853: P 1:310(309) ack 1 win 256 <nop,nop,timestamp 495425124 3541989193> (DF) |
71 |
| -00:29:08.319973 149.112.112.112.853 > 192.168.1.194.42064: . ack 310 win 118 <nop,nop,timestamp 3541989200 495425124> (DF) |
72 |
| -00:29:08.320719 149.112.112.112.853 > 192.168.1.194.42064: . 1:1449(1448) ack 310 win 118 |
| 60 | +mv /etc/resolv.conf /etc/resolv.BAK && echo "nameserver 127.0.0.1" > /etc/resolv.conf |
73 | 61 | ```
|
74 | 62 |
|
75 |
| -Set your system to start using Unbound for DNS by backing up the existing resolv.conf file and set 127.0.0.1 as the DNS server for the system: |
| 63 | +## Verify Configuration |
| 64 | + |
| 65 | +Using the [Quad9 Protocol test](https://docs.quad9.net/FAQs/#protocol-test-confirm-on-which-protocol-quad9-received-your-query), the result should be `dot.`, which indicates your queries are being sent to Quad9 and are encrypted with DNS over TLS: |
| 66 | + |
76 | 67 | ```
|
77 |
| -cp /etc/resolv.conf /etc/resolv.BAK && echo "nameserver 127.0.0.1" > /etc/resolv.conf |
| 68 | +dig +short txt proto.on.quad9.net. |
78 | 69 | ```
|
79 | 70 |
|
80 | 71 | ## Undo
|
81 | 72 |
|
82 |
| -If you want to stop using Unbound as the DNS server, simply restore the backed-up resolv.conf file: |
| 73 | +If you want to stop using Unbound as the DNS server and revert these changes, simply re-enable/start resolvd: |
83 | 74 |
|
84 | 75 | ```
|
85 |
| -mv /etc/resolv.BAK /etc/resolv.conf |
| 76 | +rcctl enable resolvd && rcctl start resolvd |
86 | 77 | ```
|
87 | 78 |
|
88 | 79 | Questions? Issues? Didn't work? Contact us!
|
|
0 commit comments