Filter AAAA records within a specific zone

Howdy!

Is there a way to have unbound filter/block AAAA records from being returned from a specific zone?

It seems like BIND might allow this using the filter-aaaa-on-v6 directive, I'm looking for something similar in Unbound.

The underlying issue is that we've recently added HE's IPv6 tunnelbroker to our network, but certain services *cough*Netflix*cough* reject traffic sent through a HE tunnel. I'm looking for a way to force problem services through IPv4 and it seems like one possible approach would be to limit their domains from retrieving AAAA records.

I ran into this problem a while back, and posted my unbound solution here:

https://www.mbcs.ca/?p=30

That's... Ugly. Effective though, and appreciated!

I was hoping for something that could work at the domain level rather than at the individual host level, but it appears only BIND offers this and I don't intend to switch from Unbound to BIND.

Can I assume this list has been at least somewhat static?

If not, or if I run into more services where this is an issue, I might need to bring up a BIND resolver just for these particular domains and have Unbound just forward these domains to BIND, but this too seems uglier than I'd like.

Either way, this will seem to get things working in the short term, and your efforts sorting it out and documenting are definitely making life easier in the short term, so my thanks!

I didn't try it, so I wouldn't know what happens to non-AAAA in a
variant of this wildcard config, but maybe sth like that, changed to
transparent, would work?:

https://www.unbound.net/pipermail/unbound-users/2009-April/000560.html

Regards, jo

Hi,

There seems to be two ways to mitigate HE-Netflix issue with Unbound -

* * *

If you know Netflix's all IPv6 address blocks, add these lines to unbound.conf:

server:
  private-address: 2406:da00:ff00::/48
  private-address: 2607:fb10::/32
  private-address: 2620:0:ef0::/48
  private-address: 2a00:86c0::/32
  private-address: 2620:108:700f::/48
  ....

This configuration removes NF's AAAA(IPv6) record from Unbound's answer.

* * *

To implement AAAA filter for NF's domain,
you need to run two Unbound instances on your machine[1].

1. Start an Unbound instance which does AAAA filter for
   _all_ domains (listening port 10053)

# unbound-aaaa-filter.conf
server:
  private-address: ::/0 # filters out all AAAA !
  port: 10053
  username: ""
  chroot: ""

2. Configure your main Unbound instance to forward netflix queries
   to AAAA-filter'ed instance.

# unbound-main.conf
server:
  do-not-query-localhost: no
forward-zone:
  name: netflix.com
  forward-addr: 127.0.0.1@10053
forward-zone:
  name: nflximg.com
  forward-addr: 127.0.0.1@10053
forward-zone:
  name: nflxext.com
  forward-addr: 127.0.0.1@10053
  ....

[1] essentially same method to configure BIND9's AAAA filter per domain:
    https://serverfault.com/questions/826872/return-a-records-but-not-aaaa-records-on-specific-domain-in-bind9