Filter IPv6 records on Turris Omnia

Due to the lack of IPv6 connectivity by my local ISP, I am using IPv6 tunnel service from Hurricane Electric. But since Netflix introduced their proxy filtering feature HE’s service is banned. Because of this I needed to force network devices to use good old IPv4 for any Netflix related traffic without giving up on IPv6 completely.

Turris Omnia is by default using Knot Resolver as DNS server and I wasn't able to find any quick way how to create a policy that would filter only AAAA records for the selected domain so as a workaround I started BIND9 instance that can do that easily and forwarded domain to that BIND instance from Kresd.

Set up BIND9

Install the server

opkg install bind-server

Replace /etc/bind/named.conf with this minimal configuration that filters AAAA:

options {
    directory "/tmp";

    forwarders {;;
    forward only;

    dnssec-enable yes;

    auth-nxdomain no;
    // run bind on the local loopback interface only and listen on port 2053
    listen-on port 2053 {; };
    listen-on-v6 port 2053 { ::1; };
    filter-aaaa-on-v4 yes;
    allow-query { any; }; // If running a on a public IP
    allow-recursion { any; }; // If running a on a public IP
    allow-query-cache { any; }; // If running a on a public IP

Enable BIND9 at boot
  /etc/init.d/named enable

And start it
  /etc/init.d/named start

Create kresd forwarding rule

Just create netflix.conf file in /etc/kresd directory with this content:

local netflix_rule = policy.add(policy.suffix(policy.FORWARD(''), policy.todnames({''})))
table.insert(policy.rules, 1, netflix_rule)

Configure Kresd

In /etc/config/resolver configuration file at kresd section add new line that will load /etc/kresd/netflix.conf config file like here:

config resolver 'kresd'
        option include_config '/etc/kresd/netflix.conf'

And now just restart kresd to use new configuration

/etc/init.d/kresd restart

Test it

BIND output

dig @localhost -p 2053 AAAA

Kresd output

dig @localhost -p 53 AAAA

Google DNS output

dig @ -p 53 AAAA

If everything works correctly in first two outputs you should not see any AAAA records.

Happy Netflix watching while using IPv6 elsewhere!


turris/kresd-filter-aaaa-for-netflix.txt · Poslední úprava: 01.01.2018 15:19 autor: vm

Nástroje pro stránku