root@opnsense:~ # dig @localhost google.com; <<>> DiG 9.18.4 <<>> @localhost google.com; (1 server found);; global options: +cmd;; Got answer:;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 2147;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1;; OPT PSEUDOSECTION:; EDNS: version: 0, flags:; udp: 1232;; QUESTION SECTION:;google.com. IN A;; Query time: 0 msec;; SERVER: 127.0.0.1#53(localhost) (UDP);; WHEN: Fri Jul 08 04:33:05 EDT 2022;; MSG SIZE rcvd: 39
✘ dan@Dan-Mac-Mini-2 ~ dig @192.168.1.1 google.com; <<>> DiG 9.10.6 <<>> @192.168.1.1 google.com; (1 server found);; global options: +cmd;; Got answer:;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 3653;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1;; OPT PSEUDOSECTION:; EDNS: version: 0, flags:; udp: 1232;; QUESTION SECTION:;google.com. IN A;; Query time: 1 msec;; SERVER: 192.168.1.1#53(192.168.1.1);; WHEN: Fri Jul 08 04:32:37 EDT 2022;; MSG SIZE rcvd: 39
root@opnsense:~ # host google.com localhostUsing domain server:Name: localhostAddress: 127.0.0.1#53Aliases:Host google.com not found: 2(SERVFAIL)
dan@Dan-MBP-2013 ~/Downloads grep error unbound_log.txt <27>1 2022-07-09T10:44:36-04:00 opnsense.familybrown.org unbound 77014 - [meta sequenceId="11066"] [77014:0] error: udp connect failed: No route to host for 2001:503:ba3e::2:30 port 53 (len 28)<27>1 2022-07-09T10:44:36-04:00 opnsense.familybrown.org unbound 77014 - [meta sequenceId="11110"] [77014:0] error: udp connect failed: No route to host for 2001:500:2d::d port 53 (len 28)<27>1 2022-07-09T10:44:36-04:00 opnsense.familybrown.org unbound 77014 - [meta sequenceId="11150"] [77014:0] error: udp connect failed: No route to host for 2001:500:2d::d port 53 (len 28)<27>1 2022-07-09T10:44:36-04:00 opnsense.familybrown.org unbound 77014 - [meta sequenceId="11188"] [77014:0] error: udp connect failed: No route to host for 2001:500:1::53 port 53 (len 28)<27>1 2022-07-09T10:44:36-04:00 opnsense.familybrown.org unbound 77014 - [meta sequenceId="11228"] [77014:0] error: udp connect failed: No route to host for 2001:500:9f::42 port 53 (len 28)<27>1 2022-07-09T10:44:36-04:00 opnsense.familybrown.org unbound 77014 - [meta sequenceId="11337"] [77014:0] error: udp connect failed: No route to host for 2001:7fe::53 port 53 (len 28)<27>1 2022-07-09T10:44:36-04:00 opnsense.familybrown.org unbound 77014 - [meta sequenceId="11377"] [77014:0] error: udp connect failed: No route to host for 2001:500:12::d0d port 53 (len 28)<27>1 2022-07-09T10:44:36-04:00 opnsense.familybrown.org unbound 77014 - [meta sequenceId="11417"] [77014:0] error: udp connect failed: No route to host for 2001:500:a8::e port 53 (len 28)<27>1 2022-07-09T10:44:36-04:00 opnsense.familybrown.org unbound 77014 - [meta sequenceId="11453"] [77014:0] error: udp connect failed: No route to host for 2001:503:ba3e::2:30 port 53 (len 28)<27>1 2022-07-09T10:44:36-04:00 opnsense.familybrown.org unbound 77014 - [meta sequenceId="11611"] [77014:0] error: udp connect failed: No route to host for 2001:500:9f::42 port 53 (len 28)<27>1 2022-07-09T10:44:36-04:00 opnsense.familybrown.org unbound 77014 - [meta sequenceId="11684"] [77014:0] error: udp connect failed: No route to host for 2001:500:2f::f port 53 (len 28)<27>1 2022-07-09T10:44:36-04:00 opnsense.familybrown.org unbound 77014 - [meta sequenceId="11756"] [77014:0] error: udp connect failed: No route to host for 2001:7fd::1 port 53 (len 28)<27>1 2022-07-09T10:44:36-04:00 opnsense.familybrown.org unbound 77014 - [meta sequenceId="11795"] [77014:0] error: udp connect failed: No route to host for 2001:500:1::53 port 53 (len 28)<27>1 2022-07-09T10:44:36-04:00 opnsense.familybrown.org unbound 77014 - [meta sequenceId="11833"] [77014:0] error: udp connect failed: No route to host for 2001:500:a8::e port 53 (len 28)<27>1 2022-07-09T10:44:36-04:00 opnsense.familybrown.org unbound 77014 - [meta sequenceId="11872"] [77014:0] error: udp connect failed: No route to host for 2001:dc3::35 port 53 (len 28)<27>1 2022-07-09T10:44:36-04:00 opnsense.familybrown.org unbound 77014 - [meta sequenceId="12111"] [77014:0] error: udp connect failed: No route to host for 2001:500:2f::f port 53 (len 28)<27>1 2022-07-09T10:44:36-04:00 opnsense.familybrown.org unbound 77014 - [meta sequenceId="12188"] [77014:0] error: udp connect failed: No route to host for 2001:500:1::53 port 53 (len 28)<27>1 2022-07-09T10:44:36-04:00 opnsense.familybrown.org unbound 77014 - [meta sequenceId="12225"] [77014:0] error: udp connect failed: No route to host for 2001:500:12::d0d port 53 (len 28)<31>1 2022-07-09T10:44:36-04:00 opnsense.familybrown.org unbound 77014 - [meta sequenceId="12310"] [77014:0] debug: return error response SERVFAIL
So that was apparently the answer--set Unbound's outgoing interface to WAN rather than all. It seems that with that set to all, Unbound expects to be able to communicate over IPv6, which it can't do, and therefore fails. A couple of things that didn't work, without setting the interface to WAN:Explicitly disabling IPv6 on LAN. It defaulted to "track interface," whatever that means; I'd suspected that explicitly disabling IPv6 on this interface (as it already was on WAN) might result in Unbound realizing that it can't communicate over IPv6 and reverting to IPv4. It didn't seem to change anything.Enabling DHCP6 on WAN. I don't use IPv6 (I have a static IPv4 address), but my ISP will give me an IPv6 address if I ask for it. But enabling this also didn't have Unbound working.What I still don't understand is why pfSense worked--as far as I can tell, it has all the same buttons, switches, and knobs, and it uses most of the same underlying software. And my pfSense box was set to "all" for the outbound interface, and it worked fine. So I'm not sure why the difference is there, but it's working, so good enough at least for now.